All of lore.kernel.org
 help / color / mirror / Atom feed
From: manushprajwal <manushprajwal555@gmail.com>
To: xingyu.wu@starfivetech.com, ziv.xu@starfivetech.com
Cc: wim@linux-watchdog.org, linux@roeck-us.net,
	linux-watchdog@vger.kernel.org
Subject: [PATCH] watchdog: starfive: fix runtime PM usage counter leak in pm_start
Date: Sun, 23 Aug 2026 16:52:25 +0530	[thread overview]
Message-ID: <20260823112225.1107-1-manushprajwal555@gmail.com> (raw)

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().

Signed-off-by: manushprajwal <manushprajwal555@gmail.com>
---
 drivers/watchdog/starfive-wdt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c
index af55adc4a..ecb704b2e 100644
--- a/drivers/watchdog/starfive-wdt.c
+++ b/drivers/watchdog/starfive-wdt.c
@@ -373,8 +373,10 @@ static int starfive_wdt_pm_start(struct watchdog_device *wdd)
 	struct starfive_wdt *wdt = watchdog_get_drvdata(wdd);
 	int ret = pm_runtime_get_sync(wdd->parent);
 
-	if (ret < 0)
+	if (ret < 0) {
+		pm_runtime_put_noidle(wdd->parent);
 		return ret;
+	}
 
 	return starfive_wdt_start(wdt);
 }
-- 
2.46.2.windows.1


             reply	other threads:[~2026-08-23 11:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-23 11:22 manushprajwal [this message]
2026-08-23 11:33 ` [PATCH] watchdog: starfive: fix runtime PM usage counter leak in pm_start sashiko-bot
2026-08-23 14:45 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260823112225.1107-1-manushprajwal555@gmail.com \
    --to=manushprajwal555@gmail.com \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=wim@linux-watchdog.org \
    --cc=xingyu.wu@starfivetech.com \
    --cc=ziv.xu@starfivetech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.