]> git.proxmox.com Git - mirror_qemu.git/commitdiff
hw/riscv: opentitan: Fixup local variables shadowing
authorAlistair Francis <alistair23@gmail.com>
Mon, 25 Sep 2023 04:30:20 +0000 (14:30 +1000)
committerMarkus Armbruster <armbru@redhat.com>
Fri, 29 Sep 2023 08:07:20 +0000 (10:07 +0200)
Local variables shadowing other local variables or parameters make the
code needlessly hard to understand.  Bugs love to hide in such code.
Evidence: "[PATCH v3 1/7] migration/rdma: Fix save_page method to fail
on polling error".

This patch removes the local variable shadowing. Tested by adding:

    --extra-cflags='-Wshadow=local -Wno-error=shadow=local -Wno-error=shadow=compatible-local'

To configure

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20230925043023.71448-2-alistair.francis@wdc.com>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
hw/riscv/opentitan.c

index 6a2fcc4ade3cba8621da34fcb46099271e5dc077..436503f1ba6491752c49a7229982b3b1e7bef73c 100644 (file)
@@ -227,7 +227,7 @@ static void lowrisc_ibex_soc_realize(DeviceState *dev_soc, Error **errp)
                                            IRQ_M_TIMER));
 
     /* SPI-Hosts */
-    for (int i = 0; i < OPENTITAN_NUM_SPI_HOSTS; ++i) {
+    for (i = 0; i < OPENTITAN_NUM_SPI_HOSTS; ++i) {
         dev = DEVICE(&(s->spi_host[i]));
         if (!sysbus_realize(SYS_BUS_DEVICE(&s->spi_host[i]), errp)) {
             return;