usb: dwc3: core: do gadget exit when drd init fails during probe

If it fails to do dwc3_drd_init() during probe, call the
dwc3_gadget_exit() to release the gadget resource when
the flag dwc->en_runtime is enabled.

Signed-off-by: William Wu <william.wu@rock-chips.com>
Change-Id: I12903841db4d83a7811b7e05d0a950932b4d3085
This commit is contained in:
William Wu
2021-01-25 09:51:02 +08:00
committed by Tao Huang
parent 53491bd312
commit b41682e5e7

View File

@@ -1308,6 +1308,9 @@ static int dwc3_core_init_mode(struct dwc3 *dwc)
}
ret = dwc3_drd_init(dwc);
if (ret) {
if (dwc->en_runtime)
dwc3_gadget_exit(dwc);
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to initialize dual-role\n");
return ret;