]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
clk: renesas: rzg2l: Rename iterator in for_each_mod_clock() to avoid shadowing
authorLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Wed, 20 May 2026 09:29:47 +0000 (10:29 +0100)
committerGeert Uytterhoeven <geert+renesas@glider.be>
Mon, 25 May 2026 09:52:48 +0000 (11:52 +0200)
Rename the internal loop iterator variable in the for_each_mod_clock()
macro from 'i' to '__i'.

The current naming conflicts with local loop variables named 'i' inside
code blocks that utilize the macro, triggering compiler warnings due to
variable shadowing:

  drivers/clk/renesas/rzg2l-cpg.c:1494:36: warning: declaration of `i` shadows a previous local [-Wshadow]
   1494 |                  for (unsigned int i = 0; i < clk->num_shared_mstop_clks; i++)

Using a unique identifier for the macro-internal iterator resolves the
shadowing warnings globally across all macro expansions.

Fixes: 3fd4a8bb4b63 ("clk: renesas: rzg2l: Add macro to loop through module clocks")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/20260520092947.70596-1-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
drivers/clk/renesas/rzg2l-cpg.c

index 0abe00e2960ba386d2152d04f8d5a386e020ea6a..51c9e19e15758535464f8646025726258264c1f6 100644 (file)
@@ -1402,10 +1402,10 @@ struct mod_clock {
 #define to_mod_clock(_hw) container_of(_hw, struct mod_clock, hw)
 
 #define for_each_mod_clock(mod_clock, hw, priv) \
-       for (unsigned int i = 0; (priv) && i < (priv)->num_mod_clks; i++) \
-               if ((priv)->clks[(priv)->num_core_clks + i] == ERR_PTR(-ENOENT)) \
+       for (unsigned int __i = 0; (priv) && __i < (priv)->num_mod_clks; __i++) \
+               if ((priv)->clks[(priv)->num_core_clks + __i] == ERR_PTR(-ENOENT)) \
                        continue; \
-               else if (((hw) = __clk_get_hw((priv)->clks[(priv)->num_core_clks + i])) && \
+               else if (((hw) = __clk_get_hw((priv)->clks[(priv)->num_core_clks + __i])) && \
                         ((mod_clock) = to_mod_clock(hw)))
 
 /* Need to be called with a lock held to avoid concurrent access to mstop->usecnt. */