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: [v2] watchdog: asm9260_wdt: fix error handling in asm9260_wdt_probe()
Date: Sun, 11 Feb 2018 09:46:37 -0800	[thread overview]
Message-ID: <20180211174637.GA19546@roeck-us.net> (raw)
In-Reply-To: <1518257847-28796-1-git-send-email-khoroshilov@ispras.ru>

On Sat, Feb 10, 2018 at 01:17:27PM +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 or to move the code around.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
> v2: Move the code around instead of disabling clks as Guenter Roeck suggested.
> 
>  drivers/watchdog/asm9260_wdt.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/asm9260_wdt.c b/drivers/watchdog/asm9260_wdt.c
> index 7dd0da644a7f..2cf56b459d84 100644
> --- a/drivers/watchdog/asm9260_wdt.c
> +++ b/drivers/watchdog/asm9260_wdt.c
> @@ -292,14 +292,14 @@ static int asm9260_wdt_probe(struct platform_device *pdev)
>  	if (IS_ERR(priv->iobase))
>  		return PTR_ERR(priv->iobase);
>  
> -	ret = asm9260_wdt_get_dt_clks(priv);
> -	if (ret)
> -		return ret;
> -
>  	priv->rst = devm_reset_control_get_exclusive(&pdev->dev, "wdt_rst");
>  	if (IS_ERR(priv->rst))
>  		return PTR_ERR(priv->rst);
>  
> +	ret = asm9260_wdt_get_dt_clks(priv);
> +	if (ret)
> +		return ret;
> +
>  	wdd = &priv->wdd;
>  	wdd->info = &asm9260_wdt_ident;
>  	wdd->ops = &asm9260_wdt_ops;

      reply	other threads:[~2018-02-11 17:46 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
2018-02-10 10:17   ` [PATCH v2] " Alexey Khoroshilov
2018-02-11 17:46     ` 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=20180211174637.GA19546@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).