Commit 3f2d8d79 authored by Kery Qi's avatar Kery Qi Committed by Wim Van Sebroeck
Browse files

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: db728ea9 ("drivers: watchdog: Add StarFive Watchdog driver")
Signed-off-by: default avatarKery Qi <qikeyu2017@gmail.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
parent 88b2ab34
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -446,7 +446,7 @@ static int starfive_wdt_probe(struct platform_device *pdev)
	platform_set_drvdata(pdev, wdt);
	pm_runtime_enable(&pdev->dev);
	if (pm_runtime_enabled(&pdev->dev)) {
		ret = pm_runtime_get_sync(&pdev->dev);
		ret = pm_runtime_resume_and_get(&pdev->dev);
		if (ret < 0)
			return ret;
	} else {