Commit 3c578cd4 authored by Alexey Khoroshilov's avatar Alexey Khoroshilov Committed by Wim Van Sebroeck

watchdog: sprd_wdt: Fix error handling in sprd_wdt_enable()

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: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
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@iguana.be>
parent d2fc8db6
...@@ -154,8 +154,10 @@ static int sprd_wdt_enable(struct sprd_wdt *wdt) ...@@ -154,8 +154,10 @@ static int sprd_wdt_enable(struct sprd_wdt *wdt)
if (ret) if (ret)
return ret; return ret;
ret = clk_prepare_enable(wdt->rtc_enable); ret = clk_prepare_enable(wdt->rtc_enable);
if (ret) if (ret) {
clk_disable_unprepare(wdt->enable);
return ret; return ret;
}
sprd_wdt_unlock(wdt->base); sprd_wdt_unlock(wdt->base);
val = readl_relaxed(wdt->base + SPRD_WDT_CTRL); val = readl_relaxed(wdt->base + SPRD_WDT_CTRL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment