Re: [PATCH] clk: starfive: jh7110-isp: fix refcount leak in jh7110_ispcrg_probe()

From: Hal Feng

Date: Mon Jun 15 2026 - 23:11:57 EST


> On 26.06.24 14:43, Wentao Liang wrote:
> 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.
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: 81279f5d0812 ("clk: starfive: Add StarFive JH7110 Image-Signal-Process
> clock driver")
> Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
> ---
> drivers/clk/starfive/clk-starfive-jh7110-isp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/starfive/clk-starfive-jh7110-isp.c
> b/drivers/clk/starfive/clk-starfive-jh7110-isp.c
> index f3fa069db193..c02c8b29a123 100644
> --- a/drivers/clk/starfive/clk-starfive-jh7110-isp.c
> +++ b/drivers/clk/starfive/clk-starfive-jh7110-isp.c
> @@ -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.

Reviewed-by: Hal Feng <hal.feng@xxxxxxxxxxxxxxxx>

Best regards,
Hal