From: Vitaly Kuzmichev Date: Fri, 13 Aug 2010 13:00:16 +0000 (+0400) Subject: USB-CDC: Correct freeing usb requests X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=0129e327f424f61a9123de44c73fe1082adb3672;p=u-boot.git USB-CDC: Correct freeing usb requests Fix in_ep and out_ep confusion (rx_req was allocated from out_ep, not from in_ep) and add lost dev->req freeing. Signed-off-by: Vitaly Kuzmichev --- diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 5b2f6dd007..51f50060a0 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -836,7 +836,7 @@ static void eth_reset_config (struct eth_dev *dev) if (dev->out) { usb_ep_disable (dev->out_ep); if (dev->rx_req) { - usb_ep_free_request (dev->in_ep, dev->rx_req); + usb_ep_free_request (dev->out_ep, dev->rx_req); dev->rx_req=NULL; } } @@ -1421,6 +1421,11 @@ static void eth_unbind (struct usb_gadget *gadget) debug("%s...\n", __func__); + /* we've already been disconnected ... no i/o is active */ + if (dev->req) { + usb_ep_free_request (gadget->ep0, dev->req); + dev->req = NULL; + } if (dev->stat_req) { usb_ep_free_request (dev->status_ep, dev->stat_req); dev->stat_req = NULL; @@ -1432,7 +1437,7 @@ static void eth_unbind (struct usb_gadget *gadget) } if (dev->rx_req) { - usb_ep_free_request (dev->in_ep, dev->rx_req); + usb_ep_free_request (dev->out_ep, dev->rx_req); dev->rx_req=NULL; }