diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2012-02-09 09:24:59 +0100 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-05-04 14:53:04 +0200 |
commit | f99987bb261ed80f645ed0acd13732922ca10138 (patch) | |
tree | 0f90fab857d5154d24d04a2abf13aab8527c9ac2 | |
parent | usb: gadget: make g_printer use composite (diff) | |
download | linux-f99987bb261ed80f645ed0acd13732922ca10138.tar.xz linux-f99987bb261ed80f645ed0acd13732922ca10138.zip |
usb: gadget: dummy_hcd: allow to free requests on disabled endpoints
ep->desc is set to NULL on endpoint disable. That means once an endpoint
is disabled it is not possible to free requests. In my target gadget I
first disable endpoints to make sure I have no requests on the fly and
then free frequests. On dummy I am leaking memory here.
Since I can't imagine a reason why it should be a bad thing, lets allow
to free requests on disabled endpoints. On removal of composite the ep0
request is removed so lets allow that here as well.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/gadget/dummy_hcd.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index a6dfd2164166..af063cbca4c4 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c @@ -595,14 +595,12 @@ static struct usb_request *dummy_alloc_request(struct usb_ep *_ep, static void dummy_free_request(struct usb_ep *_ep, struct usb_request *_req) { - struct dummy_ep *ep; struct dummy_request *req; - if (!_ep || !_req) - return; - ep = usb_ep_to_dummy_ep(_ep); - if (!ep->desc && _ep->name != ep0name) + if (!_ep || !_req) { + __WARN(); return; + } req = usb_request_to_dummy_request(_req); WARN_ON(!list_empty(&req->queue)); |