Re: [PATCH v2] watchdog: starfive: fix runtime PM usage counter leak in pm_start

From: Guenter Roeck

Date: Thu Aug 27 2026 - 10:01:58 EST


On Sun, Aug 23, 2026 at 09:14:59PM +0530, Manush Prajwal wrote:
> starfive_wdt_pm_start() calls pm_runtime_get_sync() and returns its
> error code directly on failure. Per Documentation/power/runtime_pm.rst,
> pm_runtime_get_sync() does not drop the usage counter on error, so the
> caller is expected to release the reference itself. The early return
> here skips that, leaking a runtime PM usage count on wdd->parent on
> every failed resume, which prevents the device from being suspended
> correctly afterwards.
>
> Fix it by calling pm_runtime_put_noidle() before returning, mirroring
> the same balance the counterpart starfive_wdt_pm_stop() already
> maintains with pm_runtime_put_sync().
>
> v1 only balanced the pm_runtime_get_sync() failure path. As Guenter
> Roeck and the Sashiko AI review both pointed out, the same leak
> remains if the subsequent starfive_wdt_start() call fails: the
> runtime PM reference acquired by pm_runtime_get_sync() would still be
> held while returning an error, again leaving the device unable to
> suspend. Drop the reference on that failure path too.
>
> Signed-off-by: manushprajwal <manushprajwal555@xxxxxxxxx>

checkpatch says:

WARNING: From:/Signed-off-by: email name mismatch: 'From: Manush Prajwal <manushprajwal555@xxxxxxxxx>' != 'Signed-off-by: manushprajwal <manushprajwal555@xxxxxxxxx>'

... which means that I can not apply this patch. Please fix and resend.

Thanks,
Guenter