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 as long as it is not the ep0 request Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> --- drivers/usb/gadget/dummy_hcd.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 199290c..22e82c5 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c @@ -599,8 +599,11 @@ static void dummy_free_request(struct usb_ep *_ep, struct usb_request *_req) struct dummy_ep *ep; struct dummy_request *req; - if (!_ep || !_req || (!ep->desc && _ep->name != ep0name)) + if (!_ep || !_req || (_ep->name == ep0name)) { + pr_err("%s() Can not free req: ep %p req %p ep0? %d\n", + __func__, _ep, _req, _ep->name == ep0name); return; + } ep = usb_ep_to_dummy_ep(_ep); req = usb_request_to_dummy_request(_req); -- 1.7.8.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html