[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <dd5a33f7-96b7-4f10-941e-3a597c7537de@roeck-us.net>
Date: Fri, 19 Jan 2024 04:53:19 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Ji Sheng Teoh <jisheng.teoh@...rfivetech.com>,
Xingyu Wu <xingyu.wu@...rfivetech.com>,
Samin Guo <samin.guo@...rfivetech.com>,
Wim Van Sebroeck <wim@...ux-watchdog.org>,
Emil Renner Berthing <emil.renner.berthing@...onical.com>
Cc: Ley Foon Tan <leyfoon.tan@...rfivetech.com>,
linux-watchdog@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] watchdog: starfive: Check pm_runtime_enabled() before
decrementing usage counter
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@...rfivetech.com>
> Signed-off-by: Ley Foon Tan <leyfoon.tan@...rfivetech.com>
> Signed-off-by: Ji Sheng Teoh <jisheng.teoh@...rfivetech.com>
Reviewed-by: Guenter Roeck <linux@...ck-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;
>
Powered by blists - more mailing lists