summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2014-06-10 11:02:38 -0600
committerMarek Vasut <marex@denx.de>2014-06-11 02:26:05 +0200
commitb7c0051687f42173e15b151a74e524587e8b59db (patch)
treefb41e64bb32a00f036ac2e2140d45d80ae3ec121 /drivers/usb
parent9a7d34be13a6934e0fddfaf12236d8784343f902 (diff)
downloadu-boot-imx-b7c0051687f42173e15b151a74e524587e8b59db.zip
u-boot-imx-b7c0051687f42173e15b151a74e524587e8b59db.tar.gz
u-boot-imx-b7c0051687f42173e15b151a74e524587e8b59db.tar.bz2
usb: ci_udc: clean up all allocations in unregister
usb_gadget_unregister_driver() is called to tear down the USB device mode stack. Fix the driver to stop the USB HW (which causes any attached host to notice the disappearance of the device), and free all allocations (which obviously prevents memory leaks). Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/ci_udc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c
index 1428af8..435a272 100644
--- a/drivers/usb/gadget/ci_udc.c
+++ b/drivers/usb/gadget/ci_udc.c
@@ -875,5 +875,11 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
{
+ udc_disconnect();
+
+ ci_ep_free_request(&controller.ep[0].ep, &controller.ep0_req->req);
+ free(controller.items_mem);
+ free(controller.epts);
+
return 0;
}