aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2013-03-15 04:52:08 -0400
committerFelipe Balbi <balbi@ti.com>2013-03-18 05:18:28 -0400
commitd105e7f86f890a530cdefc2a715121345de30dc2 (patch)
tree9ba1568aec725cac6674fa8e280fbcfa54f02853 /drivers/usb/dwc3
parent817e5f33d0c12f24bdfebe88c96ca2e968756da4 (diff)
usb: dwc3: fix PHY error handling
PHY layer no longer returns NULL. It will return -ENXIO when PHY layer isn't enabled and we can use that to bail out instead of request a probe deferral. Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r--drivers/usb/dwc3/core.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index c845e7087069..e2325adf9c14 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -434,12 +434,32 @@ static int dwc3_probe(struct platform_device *pdev)
434 dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3); 434 dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);
435 } 435 }
436 436
437 if (IS_ERR_OR_NULL(dwc->usb2_phy)) { 437 if (IS_ERR(dwc->usb2_phy)) {
438 ret = PTR_ERR(dwc->usb2_phy);
439
440 /*
441 * if -ENXIO is returned, it means PHY layer wasn't
442 * enabled, so it makes no sense to return -EPROBE_DEFER
443 * in that case, since no PHY driver will ever probe.
444 */
445 if (ret == -ENXIO)
446 return ret;
447
438 dev_err(dev, "no usb2 phy configured\n"); 448 dev_err(dev, "no usb2 phy configured\n");
439 return -EPROBE_DEFER; 449 return -EPROBE_DEFER;
440 } 450 }
441 451
442 if (IS_ERR_OR_NULL(dwc->usb3_phy)) { 452 if (IS_ERR(dwc->usb3_phy)) {
453 ret = PTR_ERR(dwc->usb2_phy);
454
455 /*
456 * if -ENXIO is returned, it means PHY layer wasn't
457 * enabled, so it makes no sense to return -EPROBE_DEFER
458 * in that case, since no PHY driver will ever probe.
459 */
460 if (ret == -ENXIO)
461 return ret;
462
443 dev_err(dev, "no usb3 phy configured\n"); 463 dev_err(dev, "no usb3 phy configured\n");
444 return -EPROBE_DEFER; 464 return -EPROBE_DEFER;
445 } 465 }