Skip to contentSkip to conversation

ppc/vof: Fix build error

PATCH Applied Cédric Le Goater 2 participants 3 messages Jan 12 – Jan 13

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc/vof: Fix build error

Newer gcc compiler (version 16.0.0 20260103 (Red Hat 16.0.0-0) (GCC)) detects an unused variable error:

../hw/ppc/vof.c: In function ‘vof_dt_memory_available’:
../hw/ppc/vof.c:642:12: error: variable ‘n’ set but not used [-Werror=unused-but-set-variable=]

Remove 'n'.

Cc Alexey Kardashevskiy <[email protected]>
---
 hw/ppc/vof.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
hw/ppc/vof.c +2 -3
index 5ecfc6891047eb63f498fe286d57f52a54c0a0db..fa7b73159a0b476dfc49326139d75cb87ca487c1 100644
@@ -639,7 +639,7 @@ static gint of_claimed_compare_func(gconstpointer a, gconstpointer b)
 
 static void vof_dt_memory_available(void *fdt, GArray *claimed, uint64_t base)
 {
-    int i, n, offset, proplen = 0, sc, ac;
+    int i, offset, proplen = 0, sc, ac;
     target_ulong mem0_end;
     const uint8_t *mem0_reg;
     g_autofree uint8_t *avail = NULL;
@@ -677,7 +677,7 @@ static void vof_dt_memory_available(void *fdt, GArray *claimed, uint64_t base)
     g_assert(claimed->len && (g_array_index(claimed, OfClaimed, 0).start == 0));
 
     avail = g_malloc0(sizeof(uint32_t) * (ac + sc) * claimed->len);
-    for (i = 0, n = 0, availcur = avail; i < claimed->len; ++i) {
+    for (i = 0, availcur = avail; i < claimed->len; ++i) {
         OfClaimed c = g_array_index(claimed, OfClaimed, i);
         uint64_t start, size;
 
@@ -705,7 +705,6 @@ static void vof_dt_memory_available(void *fdt, GArray *claimed, uint64_t base)
 
         if (size) {
             trace_vof_avail(c.start + c.size, c.start + c.size + size, size);
-            ++n;
         }
     }
     _FDT((fdt_setprop(fdt, offset, "available", avail, availcur - avail)));
Signature · 1 line
2.52.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Cédric Le Goater

Newer gcc compiler (version 16.0.0 20260103 (Red Hat 16.0.0-0) (GCC)) detects an unused variable error:

../hw/ppc/vof.c: In function ‘vof_dt_memory_available’:
../hw/ppc/vof.c:642:12: error: variable ‘n’ set but not used [-Werror=unused-but-set-variable=]

Quoted 7 lines

Remove 'n'.

Cc Alexey Kardashevskiy <[email protected]>
---
  hw/ppc/vof.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
author Applied
#2 lore raw
In reply to Cédric Le Goater
Quoted 37 lines · Cédric Le Goater

Newer gcc compiler (version 16.0.0 20260103 (Red Hat 16.0.0-0) (GCC)) detects an unused variable error:

../hw/ppc/vof.c: In function ‘vof_dt_memory_available’:
../hw/ppc/vof.c:642:12: error: variable ‘n’ set but not used [-Werror=unused-but-set-variable=]

Remove 'n'.

Cc Alexey Kardashevskiy <[email protected]>
---
  hw/ppc/vof.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
hw/ppc/vof.c +2 -2
index 5ecfc6891047eb63f498fe286d57f52a54c0a0db..fa7b73159a0b476dfc49326139d75cb87ca487c1 100644
@@ -639,7 +639,7 @@ static gint of_claimed_compare_func(gconstpointer a, gconstpointer b)
 
  static void vof_dt_memory_available(void *fdt, GArray *claimed, uint64_t base)
  {
-    int i, n, offset, proplen = 0, sc, ac;
+    int i, offset, proplen = 0, sc, ac;
      target_ulong mem0_end;
      const uint8_t *mem0_reg;
      g_autofree uint8_t *avail = NULL;
@@ -677,7 +677,7 @@ static void vof_dt_memory_available(void *fdt, GArray *claimed, uint64_t base)
      g_assert(claimed->len && (g_array_index(claimed, OfClaimed, 0).start == 0));
 
      avail = g_malloc0(sizeof(uint32_t) * (ac + sc) * claimed->len);
-    for (i = 0, n = 0, availcur = avail; i < claimed->len; ++i) {
+    for (i = 0, availcur = avail; i < claimed->len; ++i) {
          OfClaimed c = g_array_index(claimed, OfClaimed, i);
          uint64_t start, size;
 

hw/ppc/vof.c static void vof_dt_memory_available(void *fdt, GArray *claimed, uint64_t base) · line 710

Quoted 7 lines
hw/ppc/vof.c +0 -1
@@ -705,7 +705,6 @@ static void vof_dt_memory_available(void *fdt, GArray *claimed, uint64_t base)
 
          if (size) {
              trace_vof_avail(c.start + c.size, c.start + c.size + size, size);
-            ++n;
          }
      }
      _FDT((fdt_setprop(fdt, offset, "available", avail, availcur - avail)));

Applied to vfio-next.

Thanks,

C.