[PATCH 1/1] usb: chipidea: ci_hdrc_imx: use dev_err_probe()

Peter Chen peter.chen at kernel.org
Mon Jun 20 06:55:15 PDT 2022


On 22-06-14 14:05:22, Alexander Stein wrote:
> Use dev_err_probe() to simplify handling errors in ci_hdrc_imx_probe()
> 
> Signed-off-by: Alexander Stein <alexander.stein at ew.tq-group.com>

Acked-by: Peter Chen <peter.chen at kernel.org>

Peter
> ---
>  drivers/usb/chipidea/ci_hdrc_imx.c | 23 +++++++----------------
>  1 file changed, 7 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
> index 097142ffb184..9ffcecd3058c 100644
> --- a/drivers/usb/chipidea/ci_hdrc_imx.c
> +++ b/drivers/usb/chipidea/ci_hdrc_imx.c
> @@ -348,25 +348,18 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
>  		data->pinctrl = devm_pinctrl_get(dev);
>  		if (PTR_ERR(data->pinctrl) == -ENODEV)
>  			data->pinctrl = NULL;
> -		else if (IS_ERR(data->pinctrl)) {
> -			if (PTR_ERR(data->pinctrl) != -EPROBE_DEFER)
> -				dev_err(dev, "pinctrl get failed, err=%ld\n",
> -					PTR_ERR(data->pinctrl));
> -			return PTR_ERR(data->pinctrl);
> -		}
> +		else if (IS_ERR(data->pinctrl))
> +			return dev_err_probe(dev, PTR_ERR(data->pinctrl),
> +					     "pinctrl get failed\n");
>  
>  		data->hsic_pad_regulator =
>  				devm_regulator_get_optional(dev, "hsic");
>  		if (PTR_ERR(data->hsic_pad_regulator) == -ENODEV) {
>  			/* no pad regualator is needed */
>  			data->hsic_pad_regulator = NULL;
> -		} else if (IS_ERR(data->hsic_pad_regulator)) {
> -			if (PTR_ERR(data->hsic_pad_regulator) != -EPROBE_DEFER)
> -				dev_err(dev,
> -					"Get HSIC pad regulator error: %ld\n",
> -					PTR_ERR(data->hsic_pad_regulator));
> -			return PTR_ERR(data->hsic_pad_regulator);
> -		}
> +		} else if (IS_ERR(data->hsic_pad_regulator))
> +			return dev_err_probe(dev, PTR_ERR(data->hsic_pad_regulator),
> +					     "Get HSIC pad regulator error\n");
>  
>  		if (data->hsic_pad_regulator) {
>  			ret = regulator_enable(data->hsic_pad_regulator);
> @@ -458,9 +451,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
>  				&pdata);
>  	if (IS_ERR(data->ci_pdev)) {
>  		ret = PTR_ERR(data->ci_pdev);
> -		if (ret != -EPROBE_DEFER)
> -			dev_err(dev, "ci_hdrc_add_device failed, err=%d\n",
> -					ret);
> +		dev_err_probe(dev, ret, "ci_hdrc_add_device failed\n");
>  		goto err_clk;
>  	}
>  
> -- 
> 2.25.1
> 

-- 

Thanks,
Peter Chen




More information about the linux-arm-kernel mailing list