Skip to content

Commit

Permalink
watchdog: sprd_wdt: Fix error handling in sprd_wdt_enable()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Guenter Roeck <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Signed-off-by: Wim Van Sebroeck <[email protected]>
  • Loading branch information
khoroshilov authored and Wim Van Sebroeck committed Mar 13, 2018
1 parent d2fc8db commit 3c578cd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/watchdog/sprd_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3c578cd

Please sign in to comment.