diff options
author | Ji Sheng Teoh <jisheng.teoh@starfivetech.com> | 2024-01-19 11:27:21 +0300 |
---|---|---|
committer | Sasha Levin <sashal@kernel.org> | 2024-03-27 01:17:25 +0300 |
commit | 3a6f3974becb5e81e41cb235e25431de4b00a4d4 (patch) | |
tree | 11ced8576bfeadb745394e843f3d7b6675300979 /drivers/watchdog | |
parent | cf36c0ad50948267f29de3ab7b1606c51be38c0d (diff) | |
download | linux-3a6f3974becb5e81e41cb235e25431de4b00a4d4.tar.xz |
watchdog: starfive: Check pm_runtime_enabled() before decrementing usage counter
[ Upstream commit 8bc22a2f1bf0f402029087fcb53130233a544fed ]
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>
Link: https://lore.kernel.org/r/20240119082722.1133024-1-jisheng.teoh@starfivetech.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r-- | drivers/watchdog/starfive-wdt.c | 9 |
1 files 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; |