Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757598AbbGGOz2 (ORCPT ); Tue, 7 Jul 2015 10:55:28 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:48845 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757221AbbGGOys (ORCPT ); Tue, 7 Jul 2015 10:54:48 -0400 Date: Tue, 7 Jul 2015 17:53:45 +0300 From: Dan Carpenter To: Robert Baldyga Cc: gregkh@linuxfoundation.org, balbi@ti.com, devel@driverdev.osuosl.org, hamohammed.sa@gmail.com, chris@rorvick.com, tapaswenipathak@gmail.com, linux-usb@vger.kernel.org, nicolas.ferre@atmel.com, hgujulan@visteon.com, mina86@mina86.com, linux-kernel@vger.kernel.org, vinc94@gmail.com, roberta.dobrescu@gmail.com, andrzej.p@samsung.com, linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com Subject: Re: [PATCH 1/5] usb: gadget: ffs: call functionfs_unbind() if _ffs_func_bind() fails Message-ID: <20150707145345.GD4341@mwanda> References: <1436277773-14274-1-git-send-email-r.baldyga@samsung.com> <1436277773-14274-2-git-send-email-r.baldyga@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1436277773-14274-2-git-send-email-r.baldyga@samsung.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1143 Lines: 35 On Tue, Jul 07, 2015 at 04:02:49PM +0200, Robert Baldyga wrote: > diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c > index 6e7be91..966b214 100644 > --- a/drivers/usb/gadget/function/f_fs.c > +++ b/drivers/usb/gadget/function/f_fs.c > @@ -2897,11 +2897,19 @@ static int ffs_func_bind(struct usb_configuration *c, > struct usb_function *f) > { > struct f_fs_opts *ffs_opts = ffs_do_functionfs_bind(f, c); > + struct ffs_function *func = ffs_func_from_usb(f); > + int ret; > > if (IS_ERR(ffs_opts)) > return PTR_ERR(ffs_opts); > > - return _ffs_func_bind(c, f); > + ret = _ffs_func_bind(c, f); > + if (ret) { > + ffs_opts->refcnt--; Wait, why are we decrementing here? ffs_func_unbind() already has a decrement so this looks like a bug to me. Add a comment if it's really needed. > + functionfs_unbind(func->ffs); regards, dan carpenter -- 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/