Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1281109

[PATCH v6 2/3] usb: gadget: f_midi: fail if set_alt fails to allocate requests

From "Felipe F. Tonello" <eu@felipetonello.com>
Newsgroups linux.kernel
Subject [PATCH v6 2/3] usb: gadget: f_midi: fail if set_alt fails to allocate requests
Date 2015-12-01 19:40 +0100
Message-ID <qAY0j-4MF-29@gated-at.bofh.it> (permalink)
References <qAY0i-4MF-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
---
 drivers/usb/gadget/function/f_midi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
index e804231..79dc611 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -344,9 +344,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);
 			free_ep_req(midi->out_ep, req);
+			return err;
 		}
 	}
 
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v6 0/3] USB MIDI Gadget improvements and bug fixes "Felipe F. Tonello" <eu@felipetonello.com> - 2015-12-01 19:40 +0100
  [PATCH v6 2/3] usb: gadget: f_midi: fail if set_alt fails to allocate requests "Felipe F. Tonello" <eu@felipetonello.com> - 2015-12-01 19:40 +0100
  [PATCH v6 3/3] usb: gadget: f_midi: pre-allocate IN requests "Felipe F. Tonello" <eu@felipetonello.com> - 2015-12-01 19:40 +0100
    Re: [PATCH v6 3/3] usb: gadget: f_midi: pre-allocate IN requests Felipe Ferreri Tonello <eu@felipetonello.com> - 2015-12-08 14:00 +0100
  Re: [PATCH v6 0/3] USB MIDI Gadget improvements and bug fixes Felipe Ferreri Tonello <eu@felipetonello.com> - 2015-12-11 18:10 +0100

csiph-web