Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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) <robh@kernel.org>
Link: https://lore.kernel.org/r/20241231164456.262581-1-robh@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Rob Herring (Arm) and committed by
Greg Kroah-Hartman
533561a8 dedab674

+4 -8
+4 -8
drivers/usb/dwc3/dwc3-omap.c
··· 457 457 458 458 struct dwc3_omap *omap; 459 459 struct device *dev = &pdev->dev; 460 - struct regulator *vbus_reg = NULL; 460 + struct regulator *vbus_reg; 461 461 462 462 int ret; 463 463 int irq; ··· 483 483 if (IS_ERR(base)) 484 484 return PTR_ERR(base); 485 485 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"); 493 489 494 490 omap->dev = dev; 495 491 omap->irq = irq;