mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>,
	Wim Van Sebroeck <wim@linux-watchdog.org>
Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
	ldv-project@linuxtesting.org
Subject: Re: [PATCH] watchdog: davinci_wdt: fix error handling in davinci_wdt_probe()
Date: Fri, 23 Mar 2018 17:22:51 -0700	[thread overview]
Message-ID: <b08164bd-eef1-dae5-ebbd-a42ca55f46d9@roeck-us.net> (raw)
In-Reply-To: <1521841006-12153-1-git-send-email-khoroshilov@ispras.ru>

On 03/23/2018 02:36 PM, Alexey Khoroshilov wrote:
> clk_disable_unprepare() was added to one error path,
> but there is another one. The patch makes sure clk is
> disabled at the both of them.
> 
> 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/davinci_wdt.c | 15 +++++++++++----
>   1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
> index 3e4c592c239f..6c6594261cb7 100644
> --- a/drivers/watchdog/davinci_wdt.c
> +++ b/drivers/watchdog/davinci_wdt.c
> @@ -236,15 +236,22 @@ static int davinci_wdt_probe(struct platform_device *pdev)
>   
>   	wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>   	davinci_wdt->base = devm_ioremap_resource(dev, wdt_mem);
> -	if (IS_ERR(davinci_wdt->base))
> -		return PTR_ERR(davinci_wdt->base);
> +	if (IS_ERR(davinci_wdt->base)) {
> +		ret = PTR_ERR(davinci_wdt->base);
> +		goto err_clk_disable;
> +	}
>   
>   	ret = watchdog_register_device(wdd);
> -	if (ret < 0) {
> -		clk_disable_unprepare(davinci_wdt->clk);
> +	if (ret) {
>   		dev_err(dev, "cannot register watchdog device\n");
> +		goto err_clk_disable;
>   	}
>   
> +	return 0;
> +
> +err_clk_disable:
> +	clk_disable_unprepare(davinci_wdt->clk);
> +
>   	return ret;
>   }
>   
> 

      reply	other threads:[~2018-03-24  0:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23 21:36 Alexey Khoroshilov
2018-03-24  0:22 ` 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=b08164bd-eef1-dae5-ebbd-a42ca55f46d9@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

all inboxes | Powered by JetHome®