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

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Tue Oct 27 13:40:25 EDT 2020


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));
 		ci->vbus = NULL;
+	}
 
 	/*
 	 * Some devices have more than one clock, in this case they are enabled
-- 
2.28.0




More information about the barebox mailing list