Skip to contentSkip to conversation

usb: dwc3: keystone: Simplify with dev_err_probe()

PATCH In review Andy Shevchenko 1 participant 2 messages Oct 20, 2020 – Nov 25, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: dwc3: keystone: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.

---
 drivers/usb/dwc3/dwc3-keystone.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/usb/dwc3/dwc3-keystone.c +2 -7
index 9a99253d5ba3..057056c0975e 100644
@@ -99,13 +99,8 @@ static int kdwc3_probe(struct platform_device *pdev)
 
 	/* PSC dependency on AM65 needs SERDES0 to be powered before USB0 */
 	kdwc->usb3_phy = devm_phy_optional_get(dev, "usb3-phy");
-	if (IS_ERR(kdwc->usb3_phy)) {
-		error = PTR_ERR(kdwc->usb3_phy);
-		if (error != -EPROBE_DEFER)
-			dev_err(dev, "couldn't get usb3 phy: %d\n", error);
-
-		return error;
-	}
+	if (IS_ERR(kdwc->usb3_phy))
+		return dev_err_probe(dev, PTR_ERR(kdwc->usb3_phy), "couldn't get usb3 phy\n");
 
 	phy_pm_runtime_get_sync(kdwc->usb3_phy);
 
Signature · 1 line
2.28.0
#1 lore raw
Quoted 2 lines · Andy Shevchenko

Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.

Felipe, any comments?

Quoted 28 lines
---
 drivers/usb/dwc3/dwc3-keystone.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/usb/dwc3/dwc3-keystone.c +2 -7
index 9a99253d5ba3..057056c0975e 100644
@@ -99,13 +99,8 @@ static int kdwc3_probe(struct platform_device *pdev)
 
 	/* PSC dependency on AM65 needs SERDES0 to be powered before USB0 */
 	kdwc->usb3_phy = devm_phy_optional_get(dev, "usb3-phy");
-	if (IS_ERR(kdwc->usb3_phy)) {
-		error = PTR_ERR(kdwc->usb3_phy);
-		if (error != -EPROBE_DEFER)
-			dev_err(dev, "couldn't get usb3 phy: %d\n", error);
-
-		return error;
-	}
+	if (IS_ERR(kdwc->usb3_phy))
+		return dev_err_probe(dev, PTR_ERR(kdwc->usb3_phy), "couldn't get usb3 phy\n");
 
 	phy_pm_runtime_get_sync(kdwc->usb3_phy);
 
Signature · 1 line
2.28.0
Signature · 2 lines
With Best Regards,
Andy Shevchenko