Skip to content

Commit 7d39348

Browse files
robherringgregkh
authored andcommitted
usb: dwc3: omap: Fix devm_regulator_get_optional() error handling
Commit 533561a ("usb: dwc3: omap: Use devm_regulator_get_optional()") assumed NULL was returned, but devm_regulator_get_optional() returns -ENODEV rather than NULL like other *_get_optional() functions. Fixes: 533561a ("usb: dwc3: omap: Use devm_regulator_get_optional()") Signed-off-by: Rob Herring (Arm) <[email protected]> Acked-by: Thinh Nguyen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e84a7da commit 7d39348

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/usb/dwc3/dwc3-omap.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,11 @@ static int dwc3_omap_probe(struct platform_device *pdev)
484484
return PTR_ERR(base);
485485

486486
vbus_reg = devm_regulator_get_optional(dev, "vbus");
487-
if (IS_ERR(vbus_reg))
488-
return dev_err_probe(dev, PTR_ERR(vbus_reg), "vbus init failed\n");
487+
if (IS_ERR(vbus_reg)) {
488+
if (PTR_ERR(vbus_reg) != -ENODEV)
489+
return dev_err_probe(dev, PTR_ERR(vbus_reg), "vbus init failed\n");
490+
vbus_reg = NULL;
491+
}
489492

490493
omap->dev = dev;
491494
omap->irq = irq;

0 commit comments

Comments
 (0)