diff mbox series

[3/3] tests/qtest/pflash: Clean up local variable shadowing

Message ID 20230904162824.85385-4-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:

  tests/qtest/pflash-cfi02-test.c: In function ‘test_geometry’:
  tests/qtest/pflash-cfi02-test.c:409:22: warning: declaration of ‘byte_addr’ shadows a previous local [-Wshadow=compatible-local]
    409 |             uint64_t byte_addr = (uint64_t)i * c->sector_len[region];
        |                      ^~~~~~~~~
  tests/qtest/pflash-cfi02-test.c:342:14: note: shadowed declaration is here
    342 |     uint64_t byte_addr = 0;
        |              ^~~~~~~~~

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 tests/qtest/pflash-cfi02-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Peter Maydell Sept. 4, 2023, 4:34 p.m. UTC | #1
On Mon, 4 Sept 2023 at 17:30, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Fix:
>
>   tests/qtest/pflash-cfi02-test.c: In function ‘test_geometry’:
>   tests/qtest/pflash-cfi02-test.c:409:22: warning: declaration of ‘byte_addr’ shadows a previous local [-Wshadow=compatible-local]
>     409 |             uint64_t byte_addr = (uint64_t)i * c->sector_len[region];
>         |                      ^~~~~~~~~
>   tests/qtest/pflash-cfi02-test.c:342:14: note: shadowed declaration is here
>     342 |     uint64_t byte_addr = 0;
>         |              ^~~~~~~~~
>
> 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/tests/qtest/pflash-cfi02-test.c b/tests/qtest/pflash-cfi02-test.c
index 0b52c2ca5c..8c073efcb4 100644
--- a/tests/qtest/pflash-cfi02-test.c
+++ b/tests/qtest/pflash-cfi02-test.c
@@ -406,7 +406,7 @@  static void test_geometry(const void *opaque)
 
     for (int region = 0; region < nb_erase_regions; ++region) {
         for (uint32_t i = 0; i < c->nb_blocs[region]; ++i) {
-            uint64_t byte_addr = (uint64_t)i * c->sector_len[region];
+            byte_addr = (uint64_t)i * c->sector_len[region];
             g_assert_cmphex(flash_read(c, byte_addr), ==, bank_mask(c));
         }
     }