Skip to content

Commit 533561a

Browse files
robherringgregkh
authored andcommitted
usb: dwc3: omap: Use devm_regulator_get_optional()
The 'vbus-supply' regulator is optional, so use devm_regulator_get_optional() instead of checking for property presence first. While here, rework the error handling to use dev_err_probe() which handles deferred probe correctly without an error message. Signed-off-by: Rob Herring (Arm) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent dedab67 commit 533561a

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

drivers/usb/dwc3/dwc3-omap.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ static int dwc3_omap_probe(struct platform_device *pdev)
457457

458458
struct dwc3_omap *omap;
459459
struct device *dev = &pdev->dev;
460-
struct regulator *vbus_reg = NULL;
460+
struct regulator *vbus_reg;
461461

462462
int ret;
463463
int irq;
@@ -483,13 +483,9 @@ static int dwc3_omap_probe(struct platform_device *pdev)
483483
if (IS_ERR(base))
484484
return PTR_ERR(base);
485485

486-
if (of_property_read_bool(node, "vbus-supply")) {
487-
vbus_reg = devm_regulator_get(dev, "vbus");
488-
if (IS_ERR(vbus_reg)) {
489-
dev_err(dev, "vbus init failed\n");
490-
return PTR_ERR(vbus_reg);
491-
}
492-
}
486+
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");
493489

494490
omap->dev = dev;
495491
omap->irq = irq;

0 commit comments

Comments
 (0)