[PATCH 4/8] spapr: Clean up local variable shadowing in spapr_init_cpus()

Cédric Le Goater posted 8 patches 10 months ago
Maintainers: "Cédric Le Goater" <clg@kaod.org>, Nicholas Piggin <npiggin@gmail.com>, "Frédéric Barrat" <fbarrat@linux.ibm.com>, Daniel Henrique Barboza <danielhb413@gmail.com>, David Gibson <david@gibson.dropbear.id.au>, Harsh Prateek Bora <harshpb@linux.ibm.com>
[PATCH 4/8] spapr: Clean up local variable shadowing in spapr_init_cpus()
Posted by Cédric Le Goater 10 months ago
Remove extra 'i' variable to fix this warning :

  ../hw/ppc/spapr.c: In function ‘spapr_init_cpus’:
  ../hw/ppc/spapr.c:2668:13: warning: declaration of ‘i’ shadows a previous local [-Wshadow=compatible-local]
   2668 |         int i;
        |             ^
  ../hw/ppc/spapr.c:2645:9: note: shadowed declaration is here
   2645 |     int i;
        |         ^

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

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index d89f0fd496b6..41ce7de77c14 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2665,8 +2665,6 @@ static void spapr_init_cpus(SpaprMachineState *spapr)
     }
 
     if (smc->pre_2_10_has_unused_icps) {
-        int i;
-
         for (i = 0; i < spapr_max_server_number(spapr); i++) {
             /* Dummy entries get deregistered when real ICPState objects
              * are registered during CPU core hotplug.
-- 
2.41.0


Re: [PATCH 4/8] spapr: Clean up local variable shadowing in spapr_init_cpus()
Posted by Harsh Prateek Bora 10 months ago

On 9/18/23 20:28, Cédric Le Goater wrote:
> Remove extra 'i' variable to fix this warning :
> 
>    ../hw/ppc/spapr.c: In function ‘spapr_init_cpus’:
>    ../hw/ppc/spapr.c:2668:13: warning: declaration of ‘i’ shadows a previous local [-Wshadow=compatible-local]
>     2668 |         int i;
>          |             ^
>    ../hw/ppc/spapr.c:2645:9: note: shadowed declaration is here
>     2645 |     int i;
>          |         ^
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

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

> ---
>   hw/ppc/spapr.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index d89f0fd496b6..41ce7de77c14 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -2665,8 +2665,6 @@ static void spapr_init_cpus(SpaprMachineState *spapr)
>       }
>   
>       if (smc->pre_2_10_has_unused_icps) {
> -        int i;
> -
>           for (i = 0; i < spapr_max_server_number(spapr); i++) {
>               /* Dummy entries get deregistered when real ICPState objects
>                * are registered during CPU core hotplug.