diff mbox series

clk: rockchip: fix finding of maximum clock ID

Message ID 20240912133204.29089-2-ziyao@disroot.org (mailing list archive)
State New
Headers show
Series clk: rockchip: fix finding of maximum clock ID | expand

Commit Message

Yao Zi Sept. 12, 2024, 1:32 p.m. UTC
If an ID of a branch's child is greater than current maximum, we should
set new maximum to the child's ID, instead of its parent's.

Fixes: 2dc66a5ab2c6 ("clk: rockchip: rk3588: fix CLK_NR_CLKS usage")
Signed-off-by: Yao Zi <ziyao@disroot.org>
---
 drivers/clk/rockchip/clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sebastian Reichel Sept. 14, 2024, 6:48 a.m. UTC | #1
Hi,

On Thu, Sep 12, 2024 at 01:32:05PM GMT, Yao Zi wrote:
> If an ID of a branch's child is greater than current maximum, we should
> set new maximum to the child's ID, instead of its parent's.
> 
> Fixes: 2dc66a5ab2c6 ("clk: rockchip: rk3588: fix CLK_NR_CLKS usage")
> Signed-off-by: Yao Zi <ziyao@disroot.org>
> ---

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>

oops, good catch. Note, that the function returns the correct value
for RK3588, since the clocks with the highest IDs are of GATE_LINK
type and do not have their child field set. I have not checked all
the Rockchip SoCs converted for 6.12, so I suggest sending this as
fixes material for 6.12.

Greetings,

-- Sebastian

>  drivers/clk/rockchip/clk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c
> index 73d2cbdc716b..0972e9f87470 100644
> --- a/drivers/clk/rockchip/clk.c
> +++ b/drivers/clk/rockchip/clk.c
> @@ -439,7 +439,7 @@ unsigned long rockchip_clk_find_max_clk_id(struct rockchip_clk_branch *list,
>  		if (list->id > max)
>  			max = list->id;
>  		if (list->child && list->child->id > max)
> -			max = list->id;
> +			max = list->child->id;
>  	}
>  
>  	return max;
> -- 
> 2.46.0
>
Heiko Stuebner Sept. 14, 2024, 9:57 a.m. UTC | #2
Am Donnerstag, 12. September 2024, 15:32:05 CEST schrieb Yao Zi:
> If an ID of a branch's child is greater than current maximum, we should
> set new maximum to the child's ID, instead of its parent's.
> 
> Fixes: 2dc66a5ab2c6 ("clk: rockchip: rk3588: fix CLK_NR_CLKS usage")
> Signed-off-by: Yao Zi <ziyao@disroot.org>

Reviewed-by: Heiko Stuebner <heiko@sntech.de>

@Stephen: can you put that on top of the other Rockchip changes for 6.12
please?

Thanks a lot
Heiko

> ---
>  drivers/clk/rockchip/clk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c
> index 73d2cbdc716b..0972e9f87470 100644
> --- a/drivers/clk/rockchip/clk.c
> +++ b/drivers/clk/rockchip/clk.c
> @@ -439,7 +439,7 @@ unsigned long rockchip_clk_find_max_clk_id(struct rockchip_clk_branch *list,
>  		if (list->id > max)
>  			max = list->id;
>  		if (list->child && list->child->id > max)
> -			max = list->id;
> +			max = list->child->id;
>  	}
>  
>  	return max;
>
Yao Zi Sept. 16, 2024, 7:31 a.m. UTC | #3
On Sat, Sep 14, 2024 at 08:48:53AM +0200, Sebastian Reichel wrote:
> Hi,
> 
> On Thu, Sep 12, 2024 at 01:32:05PM GMT, Yao Zi wrote:
> > If an ID of a branch's child is greater than current maximum, we should
> > set new maximum to the child's ID, instead of its parent's.
> > 
> > Fixes: 2dc66a5ab2c6 ("clk: rockchip: rk3588: fix CLK_NR_CLKS usage")
> > Signed-off-by: Yao Zi <ziyao@disroot.org>
> > ---
> 
> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> oops, good catch. Note, that the function returns the correct value
> for RK3588, since the clocks with the highest IDs are of GATE_LINK
> type and do not have their child field set.

yes, but it does hit me when working for rk3528 clock controller unit.

> I have not checked all
> the Rockchip SoCs converted for 6.12, so I suggest sending this as
> fixes material for 6.12.

I have done a rough check and think no code in 6.11 release is affected.

> 
> Greetings,
> 
> -- Sebastian

Cheers,
Yao Zi
Stephen Boyd Oct. 9, 2024, 11:02 p.m. UTC | #4
Quoting Heiko Stübner (2024-09-14 02:57:35)
> Am Donnerstag, 12. September 2024, 15:32:05 CEST schrieb Yao Zi:
> > If an ID of a branch's child is greater than current maximum, we should
> > set new maximum to the child's ID, instead of its parent's.
> > 
> > Fixes: 2dc66a5ab2c6 ("clk: rockchip: rk3588: fix CLK_NR_CLKS usage")
> > Signed-off-by: Yao Zi <ziyao@disroot.org>
> 
> Reviewed-by: Heiko Stuebner <heiko@sntech.de>
> 
> @Stephen: can you put that on top of the other Rockchip changes for 6.12
> please?
> 

Sorry I missed this one. I'll put it on clk-fixes.
Stephen Boyd Oct. 9, 2024, 11:07 p.m. UTC | #5
Quoting Yao Zi (2024-09-12 06:32:05)
> If an ID of a branch's child is greater than current maximum, we should
> set new maximum to the child's ID, instead of its parent's.
> 
> Fixes: 2dc66a5ab2c6 ("clk: rockchip: rk3588: fix CLK_NR_CLKS usage")
> Signed-off-by: Yao Zi <ziyao@disroot.org>
> ---

Applied to clk-fixes
diff mbox series

Patch

diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c
index 73d2cbdc716b..0972e9f87470 100644
--- a/drivers/clk/rockchip/clk.c
+++ b/drivers/clk/rockchip/clk.c
@@ -439,7 +439,7 @@  unsigned long rockchip_clk_find_max_clk_id(struct rockchip_clk_branch *list,
 		if (list->id > max)
 			max = list->id;
 		if (list->child && list->child->id > max)
-			max = list->id;
+			max = list->child->id;
 	}
 
 	return max;