diff options
author | Martin Blumenstingl <martin.blumenstingl@googlemail.com> | 2020-07-04 00:50:43 +0200 |
---|---|---|
committer | Felipe Balbi <balbi@kernel.org> | 2020-09-24 10:56:16 +0200 |
commit | e1c08cf23172ed6fb228d75efc9f4c80a6812116 (patch) | |
tree | f177d9a8a28e2622ae43c17fdc65d66712b92e82 /drivers/usb/dwc2 | |
parent | usb: dwc3: core: Print warning on unsupported speed (diff) | |
download | linux-e1c08cf23172ed6fb228d75efc9f4c80a6812116.tar.xz linux-e1c08cf23172ed6fb228d75efc9f4c80a6812116.zip |
usb: dwc2: Add missing cleanups when usb_add_gadget_udc() fails
Call dwc2_debugfs_exit() and dwc2_hcd_remove() (if the HCD was enabled
earlier) when usb_add_gadget_udc() has failed. This ensures that the
debugfs entries created by dwc2_debugfs_init() as well as the HCD are
cleaned up in the error path.
Fixes: 207324a321a866 ("usb: dwc2: Postponed gadget registration to the udc class driver")
Acked-by: Minas Harutyunyan <hminas@synopsys.com>
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Diffstat (limited to 'drivers/usb/dwc2')
-rw-r--r-- | drivers/usb/dwc2/platform.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index db9fd4bd1a38..b28e90e0b685 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -584,12 +584,16 @@ static int dwc2_driver_probe(struct platform_device *dev) if (retval) { hsotg->gadget.udc = NULL; dwc2_hsotg_remove(hsotg); - goto error_init; + goto error_debugfs; } } #endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */ return 0; +error_debugfs: + dwc2_debugfs_exit(hsotg); + if (hsotg->hcd_enabled) + dwc2_hcd_remove(hsotg); error_init: if (hsotg->params.activate_stm_id_vb_detection) regulator_disable(hsotg->usb33d); |