Skip to contentSkip to conversation

clk: starfive: jh7110-isp: fix pm_runtime error handling

PATCH In review [email protected] 2 participants 2 messages Sep 18 – Sep 29

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: starfive: jh7110-isp: fix pm_runtime error handling

From: bui duc phuc <[email protected]>

pm_runtime_get_sync() leaves the runtime PM usage counter incremented even when it fails, but the error path in jh7110_ispcrg_probe() does not call pm_runtime_put_noidle() to balance it, leaking a reference each time resume fails.

Use pm_runtime_resume_and_get() instead, which automatically drops the usage counter on failure, fixing the leak.

Also disable runtime PM before returning from the error path to balance the pm_runtime_enable() call.

Fixes 81279f5d0812 ("clk: starfive: Add StarFive JH7110 Image-Signal-Process clock driver")
---
 drivers/clk/starfive/clk-starfive-jh7110-isp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/clk/starfive/clk-starfive-jh7110-isp.c +4 -2
index f3fa069db193..860c9ec897e8 100644
@@ -130,9 +130,11 @@ static int jh7110_ispcrg_probe(struct platform_device *pdev)
 
 	/* enable power domain and clocks */
 	pm_runtime_enable(priv->dev);
-	ret = pm_runtime_get_sync(priv->dev);
-	if (ret < 0)
+	ret = pm_runtime_resume_and_get(priv->dev);
+	if (ret < 0) {
+		pm_runtime_disable(priv->dev);
 		return dev_err_probe(priv->dev, ret, "failed to turn on power\n");
+	}
 
 	ret = jh7110_isp_top_rst_init(priv);
 	if (ret)
Signature · 1 line
2.43.0
#1 lore raw

Hi bui,

Quoted 7 lines · On 2026-09-18 12:00 +0700, [email protected] wrote:

From: bui duc phuc <[email protected]>

pm_runtime_get_sync() leaves the runtime PM usage counter incremented even when it fails, but the error path in jh7110_ispcrg_probe() does not call pm_runtime_put_noidle() to balance it, leaking a reference each time resume fails.

Quoted 8 lines

Use pm_runtime_resume_and_get() instead, which automatically drops the usage counter on failure, fixing the leak.

Also disable runtime PM before returning from the error path to balance the pm_runtime_enable() call.

Fixes 81279f5d0812 ("clk: starfive: Add StarFive JH7110 Image-Signal-Process clock driver")

There's a separate fix for this that I applied earlier today.

Brian