Commit 17a1dc5e authored by Peter Chen's avatar Peter Chen Committed by Felipe Balbi

usb: udc: core: fix error handling

The udc device needs to be deleted if error occurs

Fixes: 855ed04a ("usb: gadget: udc-core: independent registration of
	gadgets and gadget drivers")
Signed-off-by: default avatarPeter Chen <peter.chen@nxp.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 7442e6db
......@@ -1145,7 +1145,7 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget,
if (ret != -EPROBE_DEFER)
list_del(&driver->pending);
if (ret)
goto err4;
goto err5;
break;
}
}
......@@ -1154,6 +1154,9 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget,
return 0;
err5:
device_del(&udc->dev);
err4:
list_del(&udc->list);
mutex_unlock(&udc_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment