Skip to content

Commit 3f2d8d7

Browse files
KeryerWim Van Sebroeck
authored andcommitted
watchdog: starfive-wdt: Fix PM reference leak in probe error path
The PM reference count is not expected to be incremented on return in functions starfive_wdt_probe. However, pm_runtime_get_sync will increment pm usage counter even failed. Forgetting to putting operation will result in a reference leak here. Replace it with pm_runtime_resume_and_get to keep usage counter balanced. Fixes: db728ea ("drivers: watchdog: Add StarFive Watchdog driver") Signed-off-by: Kery Qi <qikeyu2017@gmail.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
1 parent 88b2ab3 commit 3f2d8d7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/watchdog/starfive-wdt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ static int starfive_wdt_probe(struct platform_device *pdev)
446446
platform_set_drvdata(pdev, wdt);
447447
pm_runtime_enable(&pdev->dev);
448448
if (pm_runtime_enabled(&pdev->dev)) {
449-
ret = pm_runtime_get_sync(&pdev->dev);
449+
ret = pm_runtime_resume_and_get(&pdev->dev);
450450
if (ret < 0)
451451
return ret;
452452
} else {

0 commit comments

Comments
 (0)