* [PATCH] watchdog: sprd_wdt: Fix error handling in sprd_wdt_enable()
@ 2018-03-08 21:21 Alexey Khoroshilov
2018-03-08 21:42 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Alexey Khoroshilov @ 2018-03-08 21:21 UTC (permalink / raw)
To: Eric Long, Wim Van Sebroeck, Guenter Roeck
Cc: Alexey Khoroshilov, linux-watchdog, linux-kernel, ldv-project
If clk_prepare_enable(wdt->rtc_enable) fails,
wdt->enable clock is left enabled.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
drivers/watchdog/sprd_wdt.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/watchdog/sprd_wdt.c b/drivers/watchdog/sprd_wdt.c
index a8b280ff33e0..b4d484a42b70 100644
--- a/drivers/watchdog/sprd_wdt.c
+++ b/drivers/watchdog/sprd_wdt.c
@@ -154,8 +154,10 @@ static int sprd_wdt_enable(struct sprd_wdt *wdt)
if (ret)
return ret;
ret = clk_prepare_enable(wdt->rtc_enable);
- if (ret)
+ if (ret) {
+ clk_disable_unprepare(wdt->enable);
return ret;
+ }
sprd_wdt_unlock(wdt->base);
val = readl_relaxed(wdt->base + SPRD_WDT_CTRL);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] watchdog: sprd_wdt: Fix error handling in sprd_wdt_enable()
2018-03-08 21:21 [PATCH] watchdog: sprd_wdt: Fix error handling in sprd_wdt_enable() Alexey Khoroshilov
@ 2018-03-08 21:42 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2018-03-08 21:42 UTC (permalink / raw)
To: Alexey Khoroshilov
Cc: Eric Long, Wim Van Sebroeck, linux-watchdog, linux-kernel, ldv-project
On Fri, Mar 09, 2018 at 12:21:48AM +0300, Alexey Khoroshilov wrote:
> If clk_prepare_enable(wdt->rtc_enable) fails,
> wdt->enable clock is left enabled.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/sprd_wdt.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/sprd_wdt.c b/drivers/watchdog/sprd_wdt.c
> index a8b280ff33e0..b4d484a42b70 100644
> --- a/drivers/watchdog/sprd_wdt.c
> +++ b/drivers/watchdog/sprd_wdt.c
> @@ -154,8 +154,10 @@ static int sprd_wdt_enable(struct sprd_wdt *wdt)
> if (ret)
> return ret;
> ret = clk_prepare_enable(wdt->rtc_enable);
> - if (ret)
> + if (ret) {
> + clk_disable_unprepare(wdt->enable);
> return ret;
> + }
>
> sprd_wdt_unlock(wdt->base);
> val = readl_relaxed(wdt->base + SPRD_WDT_CTRL);
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-08 21:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-08 21:21 [PATCH] watchdog: sprd_wdt: Fix error handling in sprd_wdt_enable() Alexey Khoroshilov
2018-03-08 21:42 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).