[PATCH] usb: chipidea-imx: check return value of regulator_get()

Lucas Stach l.stach at pengutronix.de
Thu Jan 7 01:55:00 PST 2016


From: David Jander <david at protonic.nl>

The VBUS regulator is optional for the chipidea-imx glue, so it must
be checked if regulator_get provided a valid regulator handle before
trying to enable the regulator.

Signed-off-by: David Jander <david at protonic.nl>
Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
---
lst: reworded commit message
---
 drivers/usb/imx/chipidea-imx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
index ae307183bc1f..a1c36cf6445d 100644
--- a/drivers/usb/imx/chipidea-imx.c
+++ b/drivers/usb/imx/chipidea-imx.c
@@ -242,7 +242,8 @@ static int imx_chipidea_probe(struct device_d *dev)
 
 	ci->vbus = regulator_get(dev, "vbus");
 
-	regulator_enable(ci->vbus);
+	if (!IS_ERR(ci->vbus))
+		regulator_enable(ci->vbus);
 
 	base = dev_request_mem_region(dev, 0);
 	if (IS_ERR(base))
-- 
2.6.4




More information about the barebox mailing list