Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <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>

authored by

Ji Sheng Teoh and committed by
Wim Van Sebroeck
8bc22a2f 975e4b27

+7 -2
+7 -2
drivers/watchdog/starfive-wdt.c
··· 494 494 if (ret) 495 495 goto err_exit; 496 496 497 - if (!early_enable) 498 - pm_runtime_put_sync(&pdev->dev); 497 + if (!early_enable) { 498 + if (pm_runtime_enabled(&pdev->dev)) { 499 + ret = pm_runtime_put_sync(&pdev->dev); 500 + if (ret) 501 + goto err_exit; 502 + } 503 + } 499 504 500 505 return 0; 501 506