[PATCH] usb: i.MX: warn if vbus regulator isn't available

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Oct 27 13:57:58 EDT 2020


Hello Uwe,

On 10/27/20 6:40 PM, Uwe Kleine-König wrote:
> Instead of just ignoring errors related to regulator yield at least a
> warning message.
> 
> In case there is no regulator in the device tree, regulator_get() returns
> the dummy regulator and not an error code. The alternative to error out
> wasn't accepted because this probably creates regressions for regulators
> that are default-on but without a driver.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
> ---
>  drivers/usb/imx/chipidea-imx.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
> index 786beede6d89..ad3eb9aa35aa 100644
> --- a/drivers/usb/imx/chipidea-imx.c
> +++ b/drivers/usb/imx/chipidea-imx.c
> @@ -267,8 +267,11 @@ static int imx_chipidea_probe(struct device_d *dev)
>  	}
>  
>  	ci->vbus = regulator_get(dev, "vbus");
> -	if (IS_ERR(ci->vbus))
> +	if (IS_ERR(ci->vbus)) {
> +		ret = ERR_PTR(ci->vbus);
> +		dev_warn(dev, "Cannot get vbus regulator: %s (ignoring)\n", strerror(-ret));

We have %pe now in barebox that you can use instead.

>  		ci->vbus = NULL;
> +	}
>  
>  	/*
>  	 * Some devices have more than one clock, in this case they are enabled
> 

-- 
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