Revert "usb: dwc3: Remove the checks of -ENOSYS"
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Wed, 15 Jun 2022 01:07:25 +0000 (18:07 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 Jun 2022 08:43:43 +0000 (10:43 +0200)
This reverts commit df22ecc41b54def624735b83784857e708bd1502.

If CONFIG_GENERIC_PHY is not enabled, then the devm_phy_get() returns
-ENOSYS. Don't remove this check.

Fixes: df22ecc41b54 ("usb: dwc3: Remove the checks of -ENOSYS")
Cc: Kushagra Verma <kushagra765@outlook.com>
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/eb1df7ef954b5af093c0528982db52a41df18615.1655255152.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/core.c

index 1bd87da..cb8742f 100644 (file)
@@ -1318,7 +1318,7 @@ static int dwc3_core_get_phy(struct dwc3 *dwc)
        dwc->usb2_generic_phy = devm_phy_get(dev, "usb2-phy");
        if (IS_ERR(dwc->usb2_generic_phy)) {
                ret = PTR_ERR(dwc->usb2_generic_phy);
-               if (ret == -ENODEV)
+               if (ret == -ENOSYS || ret == -ENODEV)
                        dwc->usb2_generic_phy = NULL;
                else
                        return dev_err_probe(dev, ret, "no usb2 phy configured\n");
@@ -1327,7 +1327,7 @@ static int dwc3_core_get_phy(struct dwc3 *dwc)
        dwc->usb3_generic_phy = devm_phy_get(dev, "usb3-phy");
        if (IS_ERR(dwc->usb3_generic_phy)) {
                ret = PTR_ERR(dwc->usb3_generic_phy);
-               if (ret == -ENODEV)
+               if (ret == -ENOSYS || ret == -ENODEV)
                        dwc->usb3_generic_phy = NULL;
                else
                        return dev_err_probe(dev, ret, "no usb3 phy configured\n");