diff mbox series

[v2] clk: renesas: r9a06g032: Repair grave increment error

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

Commit Message

Marek Vasut Oct. 28, 2022, 11:38 a.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.

Fixes: aad03a66f902 ("clk: renesas: r9a06g032: Add clock domain support")
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Ralph Siemsen <ralph.siemsen@linaro.org>
Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Gareth Williams <gareth.williams.jx@renesas.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Ralph Siemsen <ralph.siemsen@linaro.org>
---
V2: - Drop Phil, add Gareth
    - Add Fixes tag
    - Add RB from Geert, Ralph
---
 drivers/clk/renesas/r9a06g032-clocks.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Gareth Williams Oct. 31, 2022, 1:02 p.m. UTC | #1
Hi Marek,


On Fri, Oct 28, 2022 at 12:39 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.

Thanks for the patch, this looks correct to me.

Reviewed-by: Gareth Williams <gareth.williams.jx@renesas.com>

Best Regards,

Gareth

> 
> Fixes: aad03a66f902 ("clk: renesas: r9a06g032: Add clock domain support")
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Reviewed-by: Ralph Siemsen <ralph.siemsen@linaro.org>
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> Cc: Gareth Williams <gareth.williams.jx@renesas.com>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Ralph Siemsen <ralph.siemsen@linaro.org>
> ---
> V2: - Drop Phil, add Gareth
>     - Add Fixes tag
>     - Add RB from Geert, Ralph
> ---
>  drivers/clk/renesas/r9a06g032-clocks.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> 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;
> --
> 2.35.1
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;