Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756794AbbLASbR (ORCPT ); Tue, 1 Dec 2015 13:31:17 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:36977 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756358AbbLASbN (ORCPT ); Tue, 1 Dec 2015 13:31:13 -0500 From: "Felipe F. Tonello" To: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Felipe Balbi , Clemens Ladisch , Greg Kroah-Hartman , Robert Baldyga 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 Message-Id: <1448994662-21294-3-git-send-email-eu@felipetonello.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1448994662-21294-1-git-send-email-eu@felipetonello.com> References: <1448994662-21294-1-git-send-email-eu@felipetonello.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1200 Lines: 33 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 --- 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/