Skip to contentSkip to conversation

clk: renesas: r9a06g032: Repair grave increment error

PATCH Superseded Marek Vasut 3 participants 3 messages Oct 27, 2022 – Oct 28, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: renesas: r9a06g032: Repair grave increment error

If condition (clkspec.np != pd->dev.of_node) is true, then the driver ends up in endless loop, forever, locking up the machine.

---
Cc: Geert Uytterhoeven <[email protected]>
Cc: Phil Edworthy <[email protected]>
Cc: Ralph Siemsen <[email protected]>

---
 drivers/clk/renesas/r9a06g032-clocks.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/clk/renesas/r9a06g032-clocks.c +1 -2
index 1488c9d6e6394..983faa5707b9c 100644
@@ -412,7 +412,7 @@ static int r9a06g032_attach_dev(struct generic_pm_domain *pd,
 	int error;
 	int index;
 
-	while (!of_parse_phandle_with_args(np, "clocks", "#clock-cells", i,
+	while (!of_parse_phandle_with_args(np, "clocks", "#clock-cells", i++,
 					   &clkspec)) {
 		if (clkspec.np != pd->dev.of_node)
 			continue;
@@ -425,7 +425,6 @@ static int r9a06g032_attach_dev(struct generic_pm_domain *pd,
 			if (error)
 				return error;
 		}
-		i++;
 	}
 
 	return 0;
Signature · 1 line
2.35.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Marek Vasut

If condition (clkspec.np != pd->dev.of_node) is true, then the driver ends up in endless loop, forever, locking up the machine.

---
Cc: Geert Uytterhoeven <[email protected]>
Cc: Phil Edworthy <[email protected]>
Cc: Ralph Siemsen <[email protected]>
---
drivers/clk/renesas/r9a06g032-clocks.c | 3 +--

1 file changed, 1 insertion(+), 2 deletions(-)

That's a nice one!

Regards,
-Ralph

Reviewed-by on v1 1/1
#2 lore raw
In reply to Marek Vasut

CC s/Phil/Gareth/

Quoted 4 lines · Marek Vasut

If condition (clkspec.np != pd->dev.of_node) is true, then the driver ends up in endless loop, forever, locking up the machine.

Fixes aad03a66f902e18b ("clk: renesas: r9a06g032: Add clock domain support")

i.e. will queue in renesas-clk-for-v6.2.

Quoted 20 lines
drivers/clk/renesas/r9a06g032-clocks.c +1 -3
@@ -412,7 +412,7 @@ static int r9a06g032_attach_dev(struct generic_pm_domain *pd,
        int error;
        int index;
 
-       while (!of_parse_phandle_with_args(np, "clocks", "#clock-cells", i,
+       while (!of_parse_phandle_with_args(np, "clocks", "#clock-cells", i++,
                                           &clkspec)) {
                if (clkspec.np != pd->dev.of_node)
                        continue;
@@ -425,7 +425,6 @@ static int r9a06g032_attach_dev(struct generic_pm_domain *pd,
                        if (error)
                                return error;
                }
-               i++;
        }
 
        return 0;
--
Quoted 1 line

2.35.1

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds