[PATCH v3 2/4] pmdomain: rockchip: fix clock leak on domain probe failure

Shawn Lin shawn.lin at rock-chips.com
Sun Sep 20 23:52:51 PDT 2026


When of_clk_get() failed in the middle of the loop, the references of
the clocks acquired so far were leaked instead of being released by
the error path.

Fixes: d909072d0521 ("soc: rockchip: power-domain: use clk_bulk APIs")
Signed-off-by: Shawn Lin <shawn.lin at rock-chips.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel at collabora.com>
---

Changes in v3:
- drop the devm_kcalloc() to devm_kzalloc() switch; kcalloc() already
  zeroes the array and takes an element count, while devm_kzalloc()
  does not.

Changes in v2:
- add Sebastian's tag

 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 068dd4b3..b6b099b 100644
--- a/drivers/pmdomain/rockchip/pm-domains.c
+++ b/drivers/pmdomain/rockchip/pm-domains.c
@@ -842,7 +842,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
 			dev_err(pmu->dev,
 				"%pOFn: failed to get clk at index %d: %d\n",
 				node, i, error);
-			return error;
+			goto err_put_clocks;
 		}
 	}
 
-- 
2.7.4




More information about the Linux-rockchip mailing list