From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754509AbbIRRTq (ORCPT ); Fri, 18 Sep 2015 13:19:46 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:47680 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754270AbbIRRTo (ORCPT ); Fri, 18 Sep 2015 13:19:44 -0400 Date: Fri, 18 Sep 2015 12:19:38 -0500 From: Felipe Balbi To: CC: , , Peter Chen , Greg Kroah-Hartman , Felipe Balbi , Andrzej Pietrasiewicz Subject: Re: [PATCH 2/2] usb: gadget: f_midi: check for error on usb_ep_queue Message-ID: <20150918171938.GC7636@saruman.tx.rr.com> Reply-To: References: <1442596361-404-1-git-send-email-eu@felipetonello.com> <1442596361-404-3-git-send-email-eu@felipetonello.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="TiqCXmo5T1hvSQQg" Content-Disposition: inline In-Reply-To: <1442596361-404-3-git-send-email-eu@felipetonello.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --TiqCXmo5T1hvSQQg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 18, 2015 at 06:12:41PM +0100, eu@felipetonello.com wrote: > From: "Felipe F. Tonello" >=20 > f_midi is not checking weather the is an error on usb_ep_queue > request, ignoring potential problems, such as memory leaks. >=20 > Signed-off-by: Felipe F. Tonello > --- > drivers/usb/gadget/function/f_midi.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/fu= nction/f_midi.c > index ad50a67..a5e446d 100644 > --- a/drivers/usb/gadget/function/f_midi.c > +++ b/drivers/usb/gadget/function/f_midi.c > @@ -543,8 +543,14 @@ static void f_midi_transmit(struct f_midi *midi, str= uct usb_request *req) > } > } > =20 > - if (req->length > 0) > - usb_ep_queue(ep, req, GFP_ATOMIC); > + if (req->length > 0) { > + int err; > + > + err =3D usb_ep_queue(ep, req, GFP_ATOMIC); > + if (err < 0) > + ERROR(midi, "%s queue req: %d\n", > + midi->out_ep->name, err); > + } > else yeah, cool, but you need to fix the style here. This else needs to be after the curly brace and you need to curly brace to the else branch too. > free_ep_req(ep, req); > } > --=20 > 2.1.4 >=20 --=20 balbi --TiqCXmo5T1hvSQQg Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJV/EeqAAoJEIaOsuA1yqREz1MP/3b3sa44OtahGMPwrq5Pdjzi hoFZO2j24zN1y/PboLryddCalJArSU+gKBLIgPFr829xh6Q4ROdpvDjWIJ5sHljG 5gTasalb1L9NDILrc2MGm2MZaV+vtzzPELXFcFKMDcdUBcGpyWTRN8b7tnborwXm sZbWav99Uc9X9Y9jPXl23ahB3bmbqtUWoc6IORF3OeFY+KCuUEIRUExZrGdRZ/qo QpzucHRa7p6CI/OhYPxk/Kw4ghFlh7u+vK1Unkwn887DiehaQz0ejOId2CpCIuIw 5G8yed1NAqO+vOFUMPE196I3OWERXdECedwFsZHeWp3z316RShNywDb/ZqWZIKER l79YkHsR8ULQHsB/wfOocBH4vI1zsM3ODWeCtAJt0daXQoiTpvU/24Nx7TVKfUvV g4HsSr7DY4HVaziXrTbRu5/6YQrfEI98jM2O37sJA3wjnekYN9tClKccOB1esoY7 fK3YqhYNhV+FtRJKPACdZx1ZZnXqJxPY8Qu0WW+V0PIWKl+8ucBp9HDnzXTXv6cS S5zmpK87ITYLJD734C0gkjkvrWctxVRkm7yXhJCV2+pTBpZKi9wXjSEHQ9c1jN/r ioPZAmKYG7X3rlhbRHNzRYeNuUROluNVKBUvQEn/ZnCtfEtCEoHjF4tqWT0gxGQn q3FFanOplH93crUVVV9b =+vLc -----END PGP SIGNATURE----- --TiqCXmo5T1hvSQQg--