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: 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: asm9260_wdt: fix error handling in asm9260_wdt_probe()
Date: Fri, 9 Feb 2018 14:32:09 -0800	[thread overview]
Message-ID: <20180209223209.GA19627@roeck-us.net> (raw)
In-Reply-To: <1518213389-19246-1-git-send-email-khoroshilov@ispras.ru>

On Sat, Feb 10, 2018 at 12:56:29AM +0300, Alexey Khoroshilov wrote:
> If devm_reset_control_get_exclusive() fails, asm9260_wdt_probe()
> returns immediately. But clks has been already enabled at that point,
> so it is required to disable them.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> ---
>  drivers/watchdog/asm9260_wdt.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/watchdog/asm9260_wdt.c b/drivers/watchdog/asm9260_wdt.c
> index 7dd0da644a7f..de9e538a5fa8 100644
> --- a/drivers/watchdog/asm9260_wdt.c
> +++ b/drivers/watchdog/asm9260_wdt.c
> @@ -297,8 +297,10 @@ static int asm9260_wdt_probe(struct platform_device *pdev)
>  		return ret;
>  
>  	priv->rst = devm_reset_control_get_exclusive(&pdev->dev, "wdt_rst");
> -	if (IS_ERR(priv->rst))
> -		return PTR_ERR(priv->rst);
> +	if (IS_ERR(priv->rst)) {
> +		ret = PTR_ERR(priv->rst);
> +		goto clk_off;
> +	}

Good catch.

I would prefer to move the code around, ie call
devm_reset_control_get_exclusive() first and get the clocks
later.

Thanks,
Guenter

>  
>  	wdd = &priv->wdd;
>  	wdd->info = &asm9260_wdt_ident;
> -- 
> 2.7.4
> 

  reply	other threads:[~2018-02-09 22:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-09 21:56 [PATCH] watchdog: asm9260_wdt: fix error handling in asm9260_wdt_probe() Alexey Khoroshilov
2018-02-09 22:32 ` Guenter Roeck [this message]
2018-02-10 10:17   ` [PATCH v2] " Alexey Khoroshilov
2018-02-11 17:46     ` [v2] " Guenter Roeck

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=20180209223209.GA19627@roeck-us.net \
    --to=linux@roeck-us.net \
    --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).