]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
watchdog: rti-wdt: fix reference leak in rti_wdt_probe
authorZhang Qilong <zhangqilong3@huawei.com>
Fri, 30 Oct 2020 15:49:09 +0000 (23:49 +0800)
committerWim Van Sebroeck <wim@linux-watchdog.org>
Sun, 13 Dec 2020 15:17:40 +0000 (16:17 +0100)
pm_runtime_get_sync() will increment pm usage counter even it
failed. Forgetting to call pm_runtime_put_noidle will result
in reference leak in rti_wdt_probe, so we should fix it.

Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20201030154909.100023-1-zhangqilong3@huawei.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
drivers/watchdog/rti_wdt.c

index 836319cbaca9d7744a41cc4a91fb06265923b661..359302f71f7efef34ccc419842a0079be2e364b4 100644 (file)
@@ -227,8 +227,10 @@ static int rti_wdt_probe(struct platform_device *pdev)
 
        pm_runtime_enable(dev);
        ret = pm_runtime_get_sync(dev);
-       if (ret)
+       if (ret) {
+               pm_runtime_put_noidle(dev);
                return dev_err_probe(dev, ret, "runtime pm failed\n");
+       }
 
        platform_set_drvdata(pdev, wdt);