summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorJohan Hovold <johan+linaro@kernel.org>2023-04-04 10:25:20 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-04-20 11:18:22 +0300
commitc8e9eccf6ed29f6c20fa489286eee1059566d035 (patch)
treef689db8ec7196d66165b4300840cab1d6c571ef6 /drivers/usb
parentfe296046c7219c3b156cddc90a0efaa52a5eb996 (diff)
downloadlinux-c8e9eccf6ed29f6c20fa489286eee1059566d035.tar.xz
USB: dwc3: clean up phy init error handling
While there likely are no platforms out there that mix generic and legacy PHYs the driver should still be able to handle that, if only for consistency reasons. Add the missing calls to shutdown any legacy PHYs if generic PHY initialisation fails. Note that we continue to happily ignore potential errors from the legacy PHY callbacks... Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Link: https://lore.kernel.org/r/20230404072524.19014-8-johan+linaro@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/dwc3/core.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index e9cba095394c..c2326a37cd74 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1041,15 +1041,14 @@ static int dwc3_core_init(struct dwc3 *dwc)
usb_phy_init(dwc->usb2_phy);
usb_phy_init(dwc->usb3_phy);
+
ret = phy_init(dwc->usb2_generic_phy);
if (ret < 0)
- goto err0a;
+ goto err_shutdown_usb3_phy;
ret = phy_init(dwc->usb3_generic_phy);
- if (ret < 0) {
- phy_exit(dwc->usb2_generic_phy);
- goto err0a;
- }
+ if (ret < 0)
+ goto err_exit_usb2_phy;
ret = dwc3_core_soft_reset(dwc);
if (ret)
@@ -1225,11 +1224,12 @@ err2:
usb_phy_set_suspend(dwc->usb3_phy, 1);
err1:
- usb_phy_shutdown(dwc->usb2_phy);
- usb_phy_shutdown(dwc->usb3_phy);
- phy_exit(dwc->usb2_generic_phy);
phy_exit(dwc->usb3_generic_phy);
-
+err_exit_usb2_phy:
+ phy_exit(dwc->usb2_generic_phy);
+err_shutdown_usb3_phy:
+ usb_phy_shutdown(dwc->usb3_phy);
+ usb_phy_shutdown(dwc->usb2_phy);
err0a:
dwc3_ulpi_exit(dwc);