Skip to contentSkip to conversation

clk: rockchip: fix finding of maximum clock ID

PATCH Applied Yao Zi 4 participants 6 messages Sep 12, 2024 – Oct 9, 2024

Subsystems (2)
lore
Share & tools
lore

Yao Zi

author
#0 lore raw

PATCH 1/1 clk: rockchip: fix finding of maximum clock ID

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")
---
 drivers/clk/rockchip/clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/rockchip/clk.c +1 -1
index 73d2cbdc716b..0972e9f87470 100644
@@ -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;
Signature · 1 line
2.46.0
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 6 lines · 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")

---

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

Quoted 19 lines
 drivers/clk/rockchip/clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/rockchip/clk.c +1 -1
index 73d2cbdc716b..0972e9f87470 100644
@@ -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;
Signature · 1 line
2.46.0
author
#2 lore raw
Quoted 10 lines · Sebastian Reichel

Hi,

Quoted 6 lines · 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")

---

Quoted 5 lines

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.

Quoted 3 lines

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.

Quoted 4 lines

Greetings,

-- Sebastian

Cheers,
Yao Zi

maintainer Reviewed-by on v1 1/1
#3 lore raw
In reply to Yao Zi

Am Donnerstag, 12. September 2024, 15:32:05 CEST schrieb Yao Zi:

Quoted 5 lines

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")

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

Thanks a lot
Heiko

Quoted 18 lines
---
 drivers/clk/rockchip/clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/rockchip/clk.c +1 -1
index 73d2cbdc716b..0972e9f87470 100644
@@ -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;
maintainer
#4 lore raw

Quoting Heiko Stübner (2024-09-14 02:57:35)

Quoted 4 lines

Am Donnerstag, 12. September 2024, 15:32:05 CEST schrieb Yao Zi:

Quoted 3 lines

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.

Quoted 8 lines
Quoted 2 lines
Fixes 2dc66a5ab2c6 ("clk: rockchip: rk3588: fix CLK_NR_CLKS usage")

@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.

maintainer Applied
#5 lore raw
In reply to Yao Zi

Quoting Yao Zi (2024-09-12 06:32:05)

Quoted 6 lines

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")

---

Applied to clk-fixes