diff mbox series

clk: renesas: r9a06g032: Repair grave increment error

Message ID 20221027163057.37257-1-marex@denx.de (mailing list archive)
State Awaiting Upstream, archived
Headers show
Series clk: renesas: r9a06g032: Repair grave increment error | expand

Commit Message

Marek Vasut Oct. 27, 2022, 4:30 p.m. UTC
If condition (clkspec.np != pd->dev.of_node) is true, then the
driver ends up in endless loop, forever, locking up the machine.

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Phil Edworthy <phil.edworthy@renesas.com>
Cc: Ralph Siemsen <ralph.siemsen@linaro.org>
---
 drivers/clk/renesas/r9a06g032-clocks.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Ralph Siemsen Oct. 27, 2022, 5:09 p.m. UTC | #1
On Thu, Oct 27, 2022 at 06:30:57PM +0200, Marek Vasut wrote:
>If condition (clkspec.np != pd->dev.of_node) is true, then the
>driver ends up in endless loop, forever, locking up the machine.
>
>Signed-off-by: Marek Vasut <marex@denx.de>
>---
>Cc: Geert Uytterhoeven <geert+renesas@glider.be>
>Cc: Phil Edworthy <phil.edworthy@renesas.com>
>Cc: Ralph Siemsen <ralph.siemsen@linaro.org>
>---
> drivers/clk/renesas/r9a06g032-clocks.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Ralph Siemsen <ralph.siemsen@linaro.org>

That's a nice one!

Regards,
-Ralph
Geert Uytterhoeven Oct. 28, 2022, 7:18 a.m. UTC | #2
CC s/Phil/Gareth/

On Thu, Oct 27, 2022 at 6:31 PM Marek Vasut <marex@denx.de> wrote:
> If condition (clkspec.np != pd->dev.of_node) is true, then the
> driver ends up in endless loop, forever, locking up the machine.
>
> Signed-off-by: Marek Vasut <marex@denx.de>

Fixes: aad03a66f902e18b ("clk: renesas: r9a06g032: Add clock domain support")
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-clk-for-v6.2.

> --- a/drivers/clk/renesas/r9a06g032-clocks.c
> +++ b/drivers/clk/renesas/r9a06g032-clocks.c
> @@ -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;
> --
> 2.35.1

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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
diff mbox series

Patch

diff --git a/drivers/clk/renesas/r9a06g032-clocks.c b/drivers/clk/renesas/r9a06g032-clocks.c
index 1488c9d6e6394..983faa5707b9c 100644
--- a/drivers/clk/renesas/r9a06g032-clocks.c
+++ b/drivers/clk/renesas/r9a06g032-clocks.c
@@ -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;