aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJi Sheng Teoh <[email protected]>2024-01-19 16:27:21 +0800
committerWim Van Sebroeck <[email protected]>2024-03-03 14:17:28 +0100
commit8bc22a2f1bf0f402029087fcb53130233a544fed (patch)
tree4b784644b26581cfa2e4113ef85502478faaeaa0
parent975e4b273ed2c801a0354a7cdd7d89e1fe1aa842 (diff)
watchdog: starfive: Check pm_runtime_enabled() before decrementing usage counter
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 <[email protected]> Signed-off-by: Ley Foon Tan <[email protected]> Signed-off-by: Ji Sheng Teoh <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
-rw-r--r--drivers/watchdog/starfive-wdt.c9
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;