linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Eric Long <eric.long@spreadtrum.com>,
	Wim Van Sebroeck <wim@linux-watchdog.org>,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
	ldv-project@linuxtesting.org
Subject: Re: [PATCH] watchdog: sprd_wdt: Fix error handling in sprd_wdt_enable()
Date: Thu, 8 Mar 2018 13:42:27 -0800	[thread overview]
Message-ID: <20180308214227.GA28321@roeck-us.net> (raw)
In-Reply-To: <1520544108-11145-1-git-send-email-khoroshilov@ispras.ru>

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
> 

      reply	other threads:[~2018-03-08 21:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180308214227.GA28321@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=eric.long@spreadtrum.com \
    --cc=khoroshilov@ispras.ru \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).