Re: [PATCH RESEND 2/2] usb: dwc2: Return errors from PHY

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

On 11/11/2015 10:36 PM, John Youn wrote:

When searching for PHYs, any error was treated as if the PHY did not
exist or was not specified (-ENODEV). Thus the probe function did not
correctly return error conditions such as -EPROBE_DEFER.

Fixed so that only -ENODEV is ignored and any other error is returned.

Reported-by: Alexander Aring <alex.aring@xxxxxxxxx>
Signed-off-by: John Youn <johnyoun@xxxxxxxxxxxx>
---
  drivers/usb/dwc2/platform.c | 31 ++++++++++++++++++++++++++-----
  1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index b129c52..0a0e44e 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -214,14 +214,35 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
  	 */
  	hsotg->phy = devm_phy_get(hsotg->dev, "usb2-phy");
  	if (IS_ERR(hsotg->phy)) {
-		hsotg->phy = NULL;
+		ret = PTR_ERR(hsotg->phy);
+		if (ret == -ENODEV) {
+			hsotg->phy = NULL;
+		} else if (ret == -EPROBE_DEFER) {
+			return ret;
+		} else {
+			dev_err(hsotg->dev, "error getting phy %d\n", ret);
+			return ret;
+		}

   This is asking to be a *switch* statement.

+	}
+
+	if (!hsotg->phy) {
  		hsotg->uphy = devm_usb_get_phy(hsotg->dev, USB_PHY_TYPE_USB2);
-		if (IS_ERR(hsotg->uphy))
-			hsotg->uphy = NULL;
-		else
-			hsotg->plat = dev_get_platdata(hsotg->dev);
+		if (IS_ERR(hsotg->uphy)) {
+			ret = PTR_ERR(hsotg->uphy);
+			if (ret == -ENODEV) {
+				hsotg->uphy = NULL;
+			} else if (ret == -EPROBE_DEFER) {
+				return ret;
+			} else {
+				dev_err(hsotg->dev, "error getting "
+					"usb phy %d\n", ret);
+				return ret;
+			}

   This too.

[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux