mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Felipe F. Tonello" <eu@felipetonello.com>
To: linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Felipe Balbi <balbi@ti.com>,
	Clemens Ladisch <clemens@ladisch.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Robert Baldyga <r.baldyga@samsung.com>
Subject: [PATCH v6 2/3] usb: gadget: f_midi: fail if set_alt fails to allocate requests
Date: Tue,  1 Dec 2015 18:31:01 +0000	[thread overview]
Message-ID: <1448994662-21294-3-git-send-email-eu@felipetonello.com> (raw)
In-Reply-To: <1448994662-21294-1-git-send-email-eu@felipetonello.com>

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


  parent reply	other threads:[~2015-12-01 18:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-01 18:30 [PATCH v6 0/3] USB MIDI Gadget improvements and bug fixes Felipe F. Tonello
2015-12-01 18:31 ` [PATCH v6 1/3] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface Felipe F. Tonello
2015-12-01 18:31 ` Felipe F. Tonello [this message]
2015-12-01 18:31 ` [PATCH v6 3/3] usb: gadget: f_midi: pre-allocate IN requests Felipe F. Tonello
2015-12-08 12:54   ` Felipe Ferreri Tonello
2015-12-11 17:04 ` [PATCH v6 0/3] USB MIDI Gadget improvements and bug fixes Felipe Ferreri Tonello
2015-12-16 16:03   ` Felipe Balbi
2015-12-17 11:40     ` Felipe Ferreri Tonello

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1448994662-21294-3-git-send-email-eu@felipetonello.com \
    --to=eu@felipetonello.com \
    --cc=balbi@ti.com \
    --cc=clemens@ladisch.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=r.baldyga@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®