diff options
author | BALATON Zoltan <balaton@eik.bme.hu> | 2020-07-05 19:22:11 +0200 |
---|---|---|
committer | Alistair Francis <alistair.francis@wdc.com> | 2020-09-25 16:52:08 -0700 |
commit | 617160c9e1f8022563c33aa7fd204535d4d49f8c (patch) | |
tree | 9bdc09357ec3690c71f21058d88bada7b977bb33 /hw/ppc | |
parent | 8d16e72f2d4df2c9e631393adf1669a1da7efe8a (diff) | |
download | qemu-617160c9e1f8022563c33aa7fd204535d4d49f8c.zip |
load_elf: Remove unused address variables from callers
Several callers of load_elf() pass pointers for lowaddr and highaddr
parameters which are then not used for anything. This may stem from a
misunderstanding that load_elf need a value here but in fact it can
take NULL to ignore these values. Remove such unused variables and
pass NULL instead from callers that don't need these.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Message-Id: <20200705174020.BDD0174633F@zero.eik.bme.hu>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'hw/ppc')
-rw-r--r-- | hw/ppc/mac_newworld.c | 6 | ||||
-rw-r--r-- | hw/ppc/mac_oldworld.c | 6 | ||||
-rw-r--r-- | hw/ppc/ppc440_bamboo.c | 9 | ||||
-rw-r--r-- | hw/ppc/sam460ex.c | 12 | ||||
-rw-r--r-- | hw/ppc/spapr.c | 11 | ||||
-rw-r--r-- | hw/ppc/virtex_ml507.c | 4 |
6 files changed, 18 insertions, 30 deletions
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index e42bd7a626..4dfbeec0ca 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -177,7 +177,6 @@ static void ppc_core99_init(MachineState *machine) } if (linux_boot) { - uint64_t lowaddr = 0; int bswap_needed; #ifdef BSWAP_NEEDED @@ -188,9 +187,8 @@ static void ppc_core99_init(MachineState *machine) kernel_base = KERNEL_LOAD_ADDR; kernel_size = load_elf(kernel_filename, NULL, - translate_kernel_address, NULL, - NULL, &lowaddr, NULL, NULL, 1, PPC_ELF_MACHINE, - 0, 0); + translate_kernel_address, NULL, NULL, NULL, + NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0); if (kernel_size < 0) kernel_size = load_aout(kernel_filename, kernel_base, ram_size - kernel_base, bswap_needed, diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 7aba040f1b..f8173934a2 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -150,7 +150,6 @@ static void ppc_heathrow_init(MachineState *machine) } if (linux_boot) { - uint64_t lowaddr = 0; int bswap_needed; #ifdef BSWAP_NEEDED @@ -160,9 +159,8 @@ static void ppc_heathrow_init(MachineState *machine) #endif kernel_base = KERNEL_LOAD_ADDR; kernel_size = load_elf(kernel_filename, NULL, - translate_kernel_address, NULL, - NULL, &lowaddr, NULL, NULL, 1, PPC_ELF_MACHINE, - 0, 0); + translate_kernel_address, NULL, NULL, NULL, + NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0); if (kernel_size < 0) kernel_size = load_aout(kernel_filename, kernel_base, ram_size - kernel_base, bswap_needed, diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c index 4c5e9e4373..74028dc986 100644 --- a/hw/ppc/ppc440_bamboo.c +++ b/hw/ppc/ppc440_bamboo.c @@ -172,9 +172,6 @@ static void bamboo_init(MachineState *machine) PCIBus *pcibus; PowerPCCPU *cpu; CPUPPCState *env; - uint64_t elf_entry; - uint64_t elf_lowaddr; - hwaddr loadaddr = LOAD_UIMAGE_LOADADDR_INVALID; target_long initrd_size = 0; DeviceState *dev; int success; @@ -246,14 +243,14 @@ static void bamboo_init(MachineState *machine) /* Load kernel. */ if (kernel_filename) { + hwaddr loadaddr = LOAD_UIMAGE_LOADADDR_INVALID; success = load_uimage(kernel_filename, &entry, &loadaddr, NULL, NULL, NULL); if (success < 0) { + uint64_t elf_entry; success = load_elf(kernel_filename, NULL, NULL, NULL, &elf_entry, - &elf_lowaddr, NULL, NULL, 1, PPC_ELF_MACHINE, - 0, 0); + NULL, NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0); entry = elf_entry; - loadaddr = elf_lowaddr; } /* XXX try again as binary */ if (success < 0) { diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index 1702344c46..7e59a91981 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -286,7 +286,6 @@ static void sam460ex_init(MachineState *machine) CPUPPCState *env; I2CBus *i2c; hwaddr entry = UBOOT_ENTRY; - hwaddr loadaddr = LOAD_UIMAGE_LOADADDR_INVALID; target_long initrd_size = 0; DeviceState *dev; SysBusDevice *sbdev; @@ -426,17 +425,16 @@ static void sam460ex_init(MachineState *machine) /* Load kernel. */ if (machine->kernel_filename) { + hwaddr loadaddr = LOAD_UIMAGE_LOADADDR_INVALID; success = load_uimage(machine->kernel_filename, &entry, &loadaddr, NULL, NULL, NULL); if (success < 0) { - uint64_t elf_entry, elf_lowaddr; + uint64_t elf_entry; - success = load_elf(machine->kernel_filename, NULL, - NULL, NULL, &elf_entry, - &elf_lowaddr, NULL, NULL, 1, PPC_ELF_MACHINE, 0, - 0); + success = load_elf(machine->kernel_filename, NULL, NULL, NULL, + &elf_entry, NULL, NULL, NULL, + 1, PPC_ELF_MACHINE, 0, 0); entry = elf_entry; - loadaddr = elf_lowaddr; } /* XXX try again as binary */ if (success < 0) { diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 9bce1892b5..cbcd93b406 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2919,18 +2919,15 @@ static void spapr_machine_init(MachineState *machine) } if (kernel_filename) { - uint64_t lowaddr = 0; - spapr->kernel_size = load_elf(kernel_filename, NULL, translate_kernel_address, spapr, - NULL, &lowaddr, NULL, NULL, 1, + NULL, NULL, NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0); if (spapr->kernel_size == ELF_LOAD_WRONG_ENDIAN) { spapr->kernel_size = load_elf(kernel_filename, NULL, - translate_kernel_address, spapr, NULL, - &lowaddr, NULL, NULL, 0, - PPC_ELF_MACHINE, - 0, 0); + translate_kernel_address, spapr, + NULL, NULL, NULL, NULL, 0, + PPC_ELF_MACHINE, 0, 0); spapr->kernel_le = spapr->kernel_size > 0; } if (spapr->kernel_size < 0) { diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c index 78c4901be1..c790c1113f 100644 --- a/hw/ppc/virtex_ml507.c +++ b/hw/ppc/virtex_ml507.c @@ -250,12 +250,12 @@ static void virtex_init(MachineState *machine) sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq[TIMER_IRQ]); if (kernel_filename) { - uint64_t entry, low, high; + uint64_t entry, high; hwaddr boot_offset; /* Boots a kernel elf binary. */ kernel_size = load_elf(kernel_filename, NULL, NULL, NULL, - &entry, &low, &high, NULL, 1, PPC_ELF_MACHINE, + &entry, NULL, &high, NULL, 1, PPC_ELF_MACHINE, 0, 0); boot_info.bootstrap_pc = entry & 0x00ffffff; |