diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2021-01-08 17:12:11 +0000 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2021-01-19 10:20:29 +1100 |
commit | 71c3c44bc3e4b516efc868b05237aabefbf20fa8 (patch) | |
tree | 27b52888d3f8ace8d681bcd4f876afffc9004dd1 /hw/ppc/ppc405_boards.c | |
parent | 37dc4b5f7c5ef7300b3a1e2bc298db9edb0efdc5 (diff) | |
download | qemu-71c3c44bc3e4b516efc868b05237aabefbf20fa8.zip qemu-71c3c44bc3e4b516efc868b05237aabefbf20fa8.tar.gz qemu-71c3c44bc3e4b516efc868b05237aabefbf20fa8.tar.bz2 |
hw/ppc/ppc405_uc: Drop use of ppcuic_init()
Switch the ppc405_uc boards to directly creating and configuring the
UIC, rather than doing it via the old ppcuic_init() helper function.
We retain the API feature of ppc405ep_init() where it passes back
something allowing the callers to wire up devices to the UIC if
they need to, even though neither of the callsites currently makes
use of this ability -- instead of passing back the qemu_irq array
we pass back the UIC DeviceState.
This fixes a trivial Coverity-detected memory leak where
we were leaking the array of IRQs returned by ppcuic_init().
Fixes: Coverity CID 1421922
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20210108171212.16500-4-peter.maydell@linaro.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc/ppc405_boards.c')
-rw-r--r-- | hw/ppc/ppc405_boards.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c index b7249f2..8f77887 100644 --- a/hw/ppc/ppc405_boards.c +++ b/hw/ppc/ppc405_boards.c @@ -151,7 +151,6 @@ static void ref405ep_init(MachineState *machine) CPUPPCState *env; DeviceState *dev; SysBusDevice *s; - qemu_irq *pic; MemoryRegion *bios; MemoryRegion *sram = g_new(MemoryRegion, 1); ram_addr_t bdloc; @@ -167,6 +166,7 @@ static void ref405ep_init(MachineState *machine) int len; DriveInfo *dinfo; MemoryRegion *sysmem = get_system_memory(); + DeviceState *uicdev; if (machine->ram_size != mc->default_ram_size) { char *sz = size_to_str(mc->default_ram_size); @@ -184,7 +184,7 @@ static void ref405ep_init(MachineState *machine) ram_bases[1] = 0x00000000; ram_sizes[1] = 0x00000000; env = ppc405ep_init(sysmem, ram_memories, ram_bases, ram_sizes, - 33333333, &pic, kernel_filename == NULL ? 0 : 1); + 33333333, &uicdev, kernel_filename == NULL ? 0 : 1); /* allocate SRAM */ sram_size = 512 * KiB; memory_region_init_ram(sram, NULL, "ef405ep.sram", sram_size, @@ -429,7 +429,6 @@ static void taihu_405ep_init(MachineState *machine) const char *kernel_filename = machine->kernel_filename; const char *initrd_filename = machine->initrd_filename; char *filename; - qemu_irq *pic; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *bios; MemoryRegion *ram_memories = g_new(MemoryRegion, 2); @@ -440,6 +439,7 @@ static void taihu_405ep_init(MachineState *machine) int linux_boot; int fl_idx; DriveInfo *dinfo; + DeviceState *uicdev; if (machine->ram_size != mc->default_ram_size) { char *sz = size_to_str(mc->default_ram_size); @@ -459,7 +459,7 @@ static void taihu_405ep_init(MachineState *machine) "taihu_405ep.ram-1", machine->ram, ram_bases[1], ram_sizes[1]); ppc405ep_init(sysmem, ram_memories, ram_bases, ram_sizes, - 33333333, &pic, kernel_filename == NULL ? 0 : 1); + 33333333, &uicdev, kernel_filename == NULL ? 0 : 1); /* allocate and load BIOS */ fl_idx = 0; #if defined(USE_FLASH_BIOS) |