[PATCH 1/2] pmdomain: rockchip: Only put clocks that have been successfully obtained

From: Yao Zi

Date: Wed Nov 04 2026 - 22:20:48 EST


Since pd->num_clks represents the number of clocks described in
devicetree, invoking clk_bulk_put() with it will put invalid pointers
when some clocks cannot be obtained, triggering a warning in CCF like,

WARNING: drivers/clk/clk.c:4844 at __clk_put+0xf8/0x12c, CPU#0: swapper/0/1
Call trace:
__clk_put+0xf8/0x12c (P)
clk_put+0x10/0x20
clk_bulk_put+0x38/0x60
rockchip_pm_add_one_domain+0x2b0/0x468
rockchip_pm_domain_probe+0xd4/0x2f0
platform_probe+0x80/0xac
...

Invoke clk_bulk_put() with the counter used in the loop of obtaining
clocks instead.

Fixes: d8b384777066 ("pmdomain: rockchip: fix clock leak on domain probe failure")
Signed-off-by: Yao Zi <me@xxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
---
drivers/pmdomain/rockchip/pm-domains.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
index db3879846db6..34c862e56aad 100644
--- a/drivers/pmdomain/rockchip/pm-domains.c
+++ b/drivers/pmdomain/rockchip/pm-domains.c
@@ -931,7 +931,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
err_unprepare_clocks:
clk_bulk_unprepare(pd->num_clks, pd->clks);
err_put_clocks:
- clk_bulk_put(pd->num_clks, pd->clks);
+ clk_bulk_put(i, pd->clks);
return error;
}

--
2.56.0