[PATCH v2 2/2] watchdog: imxwd: Add error messages for some failure points in .probe()

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Jun 29 02:27:25 PDT 2022


On 29.06.22 10:56, Uwe Kleine-König wrote:
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum at pengutronix.de>

> ---
> Hello,
> 
> as suggested by afa I'm using dev_err_probe() here now.
> 
> Best regards
> Uwe
> 
>  drivers/watchdog/imxwd.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/imxwd.c b/drivers/watchdog/imxwd.c
> index e9856c94c2fc..dba92cb46afb 100644
> --- a/drivers/watchdog/imxwd.c
> +++ b/drivers/watchdog/imxwd.c
> @@ -245,11 +245,11 @@ static int imx_wd_probe(struct device_d *dev)
>  
>  	clk = clk_get(dev, NULL);
>  	if (IS_ERR(clk))
> -		return PTR_ERR(clk);
> +		return dev_err_probe(dev, PTR_ERR(clk), "Failed to get clk\n");
>  
>  	ret = clk_enable(clk);
>  	if (ret)
> -		return ret;
> +		return dev_err_probe(dev, ret, "Failed to enable clk\n");
>  
>  	priv->base = IOMEM(iores->start);
>  	priv->ops = ops;
> @@ -271,8 +271,10 @@ static int imx_wd_probe(struct device_d *dev)
>  		}
>  
>  		ret = watchdog_register(&priv->wd);
> -		if (ret)
> +		if (ret) {
> +			dev_err_probe(dev, ret, "Failed to register watchdog device\n");
>  			goto on_error;
> +		}
>  	}
>  
>  	if (priv->ops->init) {


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list