Skip to content

Commit

Permalink
hw/nios2: Clean up local variable shadowing
Browse files Browse the repository at this point in the history
Fix:

  hw/nios2/10m50_devboard.c: In function ‘nios2_10m50_ghrd_init’:
  hw/nios2/10m50_devboard.c:101:22: warning: declaration of ‘dev’ shadows a previous local [-Wshadow=compatible-local]
    101 |         DeviceState *dev = qdev_new(TYPE_NIOS2_VIC);
        |                      ^~~
  hw/nios2/10m50_devboard.c:60:18: note: shadowed declaration is here
     60 |     DeviceState *dev;
        |                  ^~~

  hw/nios2/10m50_devboard.c:110:18: warning: declaration of ‘i’ shadows a previous local [-Wshadow=compatible-local]
    110 |         for (int i = 0; i < 32; i++) {
        |                  ^
  hw/nios2/10m50_devboard.c:67:9: note: shadowed declaration is here
     67 |     int i;
        |         ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20230904161235.84651-15-philmd@linaro.org>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
  • Loading branch information
philmd authored and Markus Armbruster committed Sep 29, 2023
1 parent 4705c8e commit 09e24b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hw/nios2/10m50_devboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static void nios2_10m50_ghrd_init(MachineState *machine)
qdev_realize_and_unref(DEVICE(cpu), NULL, &error_fatal);

if (nms->vic) {
DeviceState *dev = qdev_new(TYPE_NIOS2_VIC);
dev = qdev_new(TYPE_NIOS2_VIC);
MemoryRegion *dev_mr;
qemu_irq cpu_irq;

Expand All @@ -107,7 +107,7 @@ static void nios2_10m50_ghrd_init(MachineState *machine)

cpu_irq = qdev_get_gpio_in_named(DEVICE(cpu), "EIC", 0);
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, cpu_irq);
for (int i = 0; i < 32; i++) {
for (i = 0; i < 32; i++) {
irq[i] = qdev_get_gpio_in(dev, i);
}

Expand Down

0 comments on commit 09e24b1

Please sign in to comment.