[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180308214227.GA28321@roeck-us.net>
Date: Thu, 8 Mar 2018 13:42:27 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Alexey Khoroshilov <khoroshilov@...ras.ru>
Cc: Eric Long <eric.long@...eadtrum.com>,
Wim Van Sebroeck <wim@...ux-watchdog.org>,
linux-watchdog@...r.kernel.org, linux-kernel@...r.kernel.org,
ldv-project@...uxtesting.org
Subject: Re: [PATCH] watchdog: sprd_wdt: Fix error handling in
sprd_wdt_enable()
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@...ras.ru>
Reviewed-by: Guenter Roeck <linux@...ck-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
>
Powered by blists - more mailing lists