clk: starfive: jh7110-isp: fix refcount leak in jh7110_ispcrg_probe()
Subsystems (3)
PATCH 1/1 clk: starfive: jh7110-isp: fix refcount leak in jh7110_ispcrg_probe()
In jh7110_ispcrg_probe(), the error path for pm_runtime_get_sync() failure directly returns without releasing the runtime PM reference count. The call to __pm_runtime_resume() increments the usage count unconditionally before attempting to resume, and does not decrement it on failure. Thus the leaked reference makes it impossible to suspend the device later.
All other error paths correctly jump to err_exit and call pm_runtime_put_sync(). Fix this by replacing pm_runtime_get_sync() with pm_runtime_resume_and_get(), which properly balances the reference count on error.
--- drivers/clk/starfive/clk-starfive-jh7110-isp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/starfive/clk-starfive-jh7110-isp.c +1 -1
@@ -130,7 +130,7 @@ 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); + ret =pm_runtime_resume_and_get (priv->dev);if (ret <0 )return dev_err_probe (priv->dev, ret,"failed to turn on power\n" );
Signature · 1 line
2.34.1
Quoted 25 lines · Wentao Liang
In
jh7110_ispcrg_probe(), the error path forpm_runtime_get_sync()failure directly returns without releasing the runtime PM reference count. The call to__pm_runtime_resume()increments the usage count unconditionally before attempting to resume, and does not decrement it on failure. Thus the leaked reference makes it impossible to suspend the device later.All other error paths correctly jump to
err_exitand callpm_runtime_put_sync(). Fix this by replacingpm_runtime_get_sync()withpm_runtime_resume_and_get(), which properly balances the reference count on error.Fixes 81279f5d0812 ("clk: starfive: Add StarFive JH7110 Image-Signal-Processclock driver")
Signed-off-by Wentao Liang <[email protected]>--- drivers/clk/starfive/clk-starfive-jh7110-isp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/clk/starfive/clk-starfive-jh7110-isp.c +0
-0
drivers/clk/starfive/clk-starfive-jh7110-isp.c static int jh7110_ispcrg_probe(struct platform_device · line 136
Quoted 8 lines
drivers/clk/starfive/clk-starfive-jh7110-isp.c +1
-1@@ -130,7 +130,7 @@ 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); + ret =pm_runtime_resume_and_get (priv->dev);if (ret <0 )return dev_err_probe (priv->dev, ret,"failed to turn on power\n" );
Looks good. Keep it consistent with drivers/clk/starfive/clk-starfive-jh7110-vout.c.
Best regards,
Hal
Brian Masney
AppliedQuoted 1 line · Wentao Liang
clk: starfive: jh7110-isp: fix refcount leak in
jh7110_ispcrg_probe()
Applied, thanks!
[1/1] clk: starfive: jh7110-isp: fix refcount leak in jh7110_ispcrg_probe()
commit: 1c4f9480473917558908c083d1293b4ebb3d50c5
Best regards,
Signature · 1 line
Brian Masney <[email protected]>