usb: gadget: f_midi: fix leak on failed to enqueue out requests

This patch fixes a memory leak that occurs when an endpoint fails to enqueue
the request. If that happens the complete function will never be called, thus
never freeing the request.

Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>

Change-Id: Ia0bcb5cbb7db7adb920402340f7ae658e2d32ae7
This commit is contained in:
Felipe F. Tonello 2015-11-10 17:52:06 +00:00 committed by L R
parent 38a292f25a
commit a380605e7c
1 changed files with 1 additions and 0 deletions

View File

@ -379,6 +379,7 @@ static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
if (err) {
ERROR(midi, "%s queue req: %d\n",
midi->out_ep->name, err);
midi_free_ep_req(midi->out_ep, req);
}
}