summaryrefslogtreecommitdiff
path: root/drivers/watchdog/sprd_wdt.c
diff options
context:
space:
mode:
authorAlexey Khoroshilov <khoroshilov@ispras.ru>2018-03-09 00:21:48 +0300
committerWim Van Sebroeck <wim@linux-watchdog.org>2018-03-13 21:14:18 +0300
commit3c578cd4bc52b6e65d65be1abad9a8aa489ec207 (patch)
treea7f1ce2eb944527c5bb8962a977f2b46caed3ea8 /drivers/watchdog/sprd_wdt.c
parentd2fc8db691bf3197d43b2afb553311a9bf257bff (diff)
downloadlinux-3c578cd4bc52b6e65d65be1abad9a8aa489ec207.tar.xz
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: Alexey Khoroshilov <khoroshilov@ispras.ru> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog/sprd_wdt.c')
-rw-r--r--drivers/watchdog/sprd_wdt.c4
1 files changed, 3 insertions, 1 deletions
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);