Skip to content

Commit e265ee4

Browse files
committed
hw/loader: Clean up global variable shadowing in rom_add_file()
Fix: hw/core/loader.c:1073:27: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] bool option_rom, MemoryRegion *mr, ^ include/sysemu/sysemu.h:57:22: note: previous declaration is here extern QEMUOptionRom option_rom[MAX_OPTION_ROMS]; ^ Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Ani Sinha <anisinha@redhat.com> Message-Id: <20231010115048.11856-3-philmd@linaro.org>
1 parent 3c55dd5 commit e265ee4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

hw/core/loader.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ static void *rom_set_mr(Rom *rom, Object *owner, const char *name, bool ro)
10701070

10711071
ssize_t rom_add_file(const char *file, const char *fw_dir,
10721072
hwaddr addr, int32_t bootindex,
1073-
bool option_rom, MemoryRegion *mr,
1073+
bool has_option_rom, MemoryRegion *mr,
10741074
AddressSpace *as)
10751075
{
10761076
MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
@@ -1139,7 +1139,7 @@ ssize_t rom_add_file(const char *file, const char *fw_dir,
11391139
basename);
11401140
snprintf(devpath, sizeof(devpath), "/rom@%s", fw_file_name);
11411141

1142-
if ((!option_rom || mc->option_rom_has_mr) && mc->rom_file_has_mr) {
1142+
if ((!has_option_rom || mc->option_rom_has_mr) && mc->rom_file_has_mr) {
11431143
data = rom_set_mr(rom, OBJECT(fw_cfg), devpath, true);
11441144
} else {
11451145
data = rom->data;

include/hw/loader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ void pstrcpy_targphys(const char *name,
272272

273273
ssize_t rom_add_file(const char *file, const char *fw_dir,
274274
hwaddr addr, int32_t bootindex,
275-
bool option_rom, MemoryRegion *mr, AddressSpace *as);
275+
bool has_option_rom, MemoryRegion *mr, AddressSpace *as);
276276
MemoryRegion *rom_add_blob(const char *name, const void *blob, size_t len,
277277
size_t max_len, hwaddr addr,
278278
const char *fw_file_name,

0 commit comments

Comments
 (0)