usb: gadget: f_midi: fail if set_alt fails to allocate requests

This ensures that the midi function will only work if the proper number of
IN and OUT requrests are allocated. Otherwise the function will work with less
requests then what the user wants.

Change-Id: If5964d44ebd1dfc7e705c7695ce9d12f83007cd2
Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
Felipe F. Tonello 2015-12-01 18:31:01 +00:00 committed by L R
parent a380605e7c
commit 02c9e1032a
1 changed files with 2 additions and 1 deletions

View File

@ -377,9 +377,10 @@ static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
req->complete = f_midi_complete;
err = usb_ep_queue(midi->out_ep, req, GFP_ATOMIC);
if (err) {
ERROR(midi, "%s queue req: %d\n",
ERROR(midi, "%s: couldn't enqueue request: %d\n",
midi->out_ep->name, err);
midi_free_ep_req(midi->out_ep, req);
return err;
}
}