qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 7/8] spapr/pci: Clean up local variable shadowing in spapr_ph


From: Harsh Prateek Bora
Subject: Re: [PATCH 7/8] spapr/pci: Clean up local variable shadowing in spapr_phb_realize()
Date: Tue, 19 Sep 2023 14:08:54 +0530
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0



On 9/18/23 20:28, Cédric Le Goater wrote:
Rename SysBusDevice variable to avoid this warning :

   ../hw/ppc/spapr_pci.c: In function ‘spapr_phb_realize’:
   ../hw/ppc/spapr_pci.c:1872:24: warning: declaration of ‘s’ shadows a 
previous local [-Wshadow=local]
    1872 |         SpaprPhbState *s;
         |                        ^
   ../hw/ppc/spapr_pci.c:1829:19: note: shadowed declaration is here
    1829 |     SysBusDevice *s = SYS_BUS_DEVICE(dev);
         |                   ^

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
  hw/ppc/spapr_pci.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index ce1495931744..370c5a90f218 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -1826,9 +1826,9 @@ static void spapr_phb_realize(DeviceState *dev, Error 
**errp)
          (SpaprMachineState *) object_dynamic_cast(qdev_get_machine(),
                                                    TYPE_SPAPR_MACHINE);
      SpaprMachineClass *smc = spapr ? SPAPR_MACHINE_GET_CLASS(spapr) : NULL;
-    SysBusDevice *s = SYS_BUS_DEVICE(dev);
-    SpaprPhbState *sphb = SPAPR_PCI_HOST_BRIDGE(s);
-    PCIHostState *phb = PCI_HOST_BRIDGE(s);
+    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
+    SpaprPhbState *sphb = SPAPR_PCI_HOST_BRIDGE(sbd);

Declaration of SpaprPhbState *s later in the code could be brought here?

Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>

+    PCIHostState *phb = PCI_HOST_BRIDGE(sbd);
      MachineState *ms = MACHINE(spapr);
      char *namebuf;
      int i;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]