Commit f99987bb261ed80f645ed0acd13732922ca10138
Committed by
Felipe Balbi
1 parent
2e87edf492
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 1 changed file with 3 additions and 5 deletions Side-by-side Diff
drivers/usb/gadget/dummy_hcd.c
... | ... | @@ -595,14 +595,12 @@ |
595 | 595 | |
596 | 596 | static void dummy_free_request(struct usb_ep *_ep, struct usb_request *_req) |
597 | 597 | { |
598 | - struct dummy_ep *ep; | |
599 | 598 | struct dummy_request *req; |
600 | 599 | |
601 | - if (!_ep || !_req) | |
600 | + if (!_ep || !_req) { | |
601 | + __WARN(); | |
602 | 602 | return; |
603 | - ep = usb_ep_to_dummy_ep(_ep); | |
604 | - if (!ep->desc && _ep->name != ep0name) | |
605 | - return; | |
603 | + } | |
606 | 604 | |
607 | 605 | req = usb_request_to_dummy_request(_req); |
608 | 606 | WARN_ON(!list_empty(&req->queue)); |