From: Guenter Roeck <linux@roeck-us.net>
To: Ji Sheng Teoh <jisheng.teoh@starfivetech.com>,
Xingyu Wu <xingyu.wu@starfivetech.com>,
Samin Guo <samin.guo@starfivetech.com>,
Wim Van Sebroeck <wim@linux-watchdog.org>,
Emil Renner Berthing <emil.renner.berthing@canonical.com>
Cc: Ley Foon Tan <leyfoon.tan@starfivetech.com>,
linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] watchdog: starfive: Check pm_runtime_enabled() before decrementing usage counter
Date: Fri, 19 Jan 2024 04:53:19 -0800 [thread overview]
Message-ID: <dd5a33f7-96b7-4f10-941e-3a597c7537de@roeck-us.net> (raw)
In-Reply-To: <20240119082722.1133024-1-jisheng.teoh@starfivetech.com>
On 1/19/24 00:27, Ji Sheng Teoh wrote:
> In the probe function, pm_runtime_put_sync() will fail on platform with
> runtime PM disabled.
> Check if runtime PM is enabled before calling pm_runtime_put_sync() to
> fix it.
>
> Fixes: db728ea9c7be ("drivers: watchdog: Add StarFive Watchdog driver")
> Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
> Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
> Signed-off-by: Ji Sheng Teoh <jisheng.teoh@starfivetech.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Guenter
> ---
> drivers/watchdog/starfive-wdt.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c
> index e28ead24c520..df68ae4acbd7 100644
> --- a/drivers/watchdog/starfive-wdt.c
> +++ b/drivers/watchdog/starfive-wdt.c
> @@ -494,8 +494,13 @@ static int starfive_wdt_probe(struct platform_device *pdev)
> if (ret)
> goto err_exit;
>
> - if (!early_enable)
> - pm_runtime_put_sync(&pdev->dev);
> + if (!early_enable) {
> + if (pm_runtime_enabled(&pdev->dev)) {
> + ret = pm_runtime_put_sync(&pdev->dev);
> + if (ret)
> + goto err_exit;
> + }
> + }
>
> return 0;
>
prev parent reply other threads:[~2024-01-19 12:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-19 8:27 Ji Sheng Teoh
2024-01-19 12:53 ` Guenter Roeck [this message]
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=dd5a33f7-96b7-4f10-941e-3a597c7537de@roeck-us.net \
--to=linux@roeck-us.net \
--cc=emil.renner.berthing@canonical.com \
--cc=jisheng.teoh@starfivetech.com \
--cc=leyfoon.tan@starfivetech.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=samin.guo@starfivetech.com \
--cc=wim@linux-watchdog.org \
--cc=xingyu.wu@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 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®