diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index db9fd4bd1a38c..b28e90e0b685d 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);