diff mbox series

[2/3] hw/intc/openpic: Clean up local variable shadowing

Message ID 20230904162824.85385-3-philmd@linaro.org
State New
Headers show
Series (few more) Steps towards enabling -Wshadow [3 more] | expand

Commit Message

Philippe Mathieu-Daudé Sept. 4, 2023, 4:28 p.m. UTC
Fix:

  hw/intc/openpic.c: In function ‘openpic_gbl_write’:
  hw/intc/openpic.c:614:17: warning: declaration of ‘idx’ shadows a previous local [-Wshadow=compatible-local]
    614 |             int idx;
        |                 ^~~
  hw/intc/openpic.c:568:9: note: shadowed declaration is here
    568 |     int idx;
        |         ^~~

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/intc/openpic.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Peter Maydell Sept. 4, 2023, 4:33 p.m. UTC | #1
On Mon, 4 Sept 2023 at 17:28, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Fix:
>
>   hw/intc/openpic.c: In function ‘openpic_gbl_write’:
>   hw/intc/openpic.c:614:17: warning: declaration of ‘idx’ shadows a previous local [-Wshadow=compatible-local]
>     614 |             int idx;
>         |                 ^~~
>   hw/intc/openpic.c:568:9: note: shadowed declaration is here
>     568 |     int idx;
>         |         ^~~
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
diff mbox series

Patch

diff --git a/hw/intc/openpic.c b/hw/intc/openpic.c
index c757adbe53..a6f91d4bcd 100644
--- a/hw/intc/openpic.c
+++ b/hw/intc/openpic.c
@@ -610,11 +610,8 @@  static void openpic_gbl_write(void *opaque, hwaddr addr, uint64_t val,
     case 0x10B0:
     case 0x10C0:
     case 0x10D0:
-        {
-            int idx;
-            idx = (addr - 0x10A0) >> 4;
-            write_IRQreg_ivpr(opp, opp->irq_ipi0 + idx, val);
-        }
+        idx = (addr - 0x10A0) >> 4;
+        write_IRQreg_ivpr(opp, opp->irq_ipi0 + idx, val);
         break;
     case 0x10E0: /* SPVE */
         opp->spve = val & opp->vector_mask;