Re: [PATCH] watchdog: asm9260_wdt: fix error handling in asm9260_wdt_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> ---
>  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
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux