mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] clk: starfive: jh7110-isp: fix pm_runtime error handling
@ 2026-09-18  5:00 phucduc.bui
  0 siblings, 0 replies; only message in thread
From: phucduc.bui @ 2026-09-18  5:00 UTC (permalink / raw)
  To: Emil Renner Berthing, Hal Feng, Stephen Boyd, Brian Masney,
	Jerome Brunet, Conor Dooley
  Cc: Palmer Dabbelt, Xingyu Wu, linux-clk, linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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")
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/clk/starfive/clk-starfive-jh7110-isp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/starfive/clk-starfive-jh7110-isp.c b/drivers/clk/starfive/clk-starfive-jh7110-isp.c
index f3fa069db193..860c9ec897e8 100644
--- a/drivers/clk/starfive/clk-starfive-jh7110-isp.c
+++ b/drivers/clk/starfive/clk-starfive-jh7110-isp.c
@@ -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)
-- 
2.43.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-18  5:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-18  5:00 [PATCH] clk: starfive: jh7110-isp: fix pm_runtime error handling phucduc.bui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®