* [PATCH] watchdog: rti-wdt: fix reference leak in rti_wdt_probe
@ 2020-10-30 15:49 Zhang Qilong
2020-10-30 17:35 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Zhang Qilong @ 2020-10-30 15:49 UTC (permalink / raw)
To: wim, linux; +Cc: linux-watchdog
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>
---
drivers/watchdog/rti_wdt.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c
index 836319cbaca9..359302f71f7e 100644
--- a/drivers/watchdog/rti_wdt.c
+++ b/drivers/watchdog/rti_wdt.c
@@ -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);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] watchdog: rti-wdt: fix reference leak in rti_wdt_probe
2020-10-30 15:49 [PATCH] watchdog: rti-wdt: fix reference leak in rti_wdt_probe Zhang Qilong
@ 2020-10-30 17:35 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2020-10-30 17:35 UTC (permalink / raw)
To: Zhang Qilong; +Cc: wim, linux-watchdog
On Fri, Oct 30, 2020 at 11:49:09PM +0800, Zhang Qilong wrote:
> 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>
> ---
> drivers/watchdog/rti_wdt.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c
> index 836319cbaca9..359302f71f7e 100644
> --- a/drivers/watchdog/rti_wdt.c
> +++ b/drivers/watchdog/rti_wdt.c
> @@ -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);
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-30 17:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-30 15:49 [PATCH] watchdog: rti-wdt: fix reference leak in rti_wdt_probe Zhang Qilong
2020-10-30 17:35 ` Guenter Roeck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.