[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 07 Jul 2015 18:00:27 +0200
From: Robert Baldyga <r.baldyga@...kerion.com>
To: Dan Carpenter <dan.carpenter@...cle.com>,
Robert Baldyga <r.baldyga@...sung.com>
CC: gregkh@...uxfoundation.org, balbi@...com,
devel@...verdev.osuosl.org, hamohammed.sa@...il.com,
chris@...vick.com, tapaswenipathak@...il.com,
linux-usb@...r.kernel.org, nicolas.ferre@...el.com,
hgujulan@...teon.com, mina86@...a86.com,
linux-kernel@...r.kernel.org, vinc94@...il.com,
roberta.dobrescu@...il.com, andrzej.p@...sung.com,
linux-arm-kernel@...ts.infradead.org, m.szyprowski@...sung.com
Subject: Re: [PATCH 1/5] usb: gadget: ffs: call functionfs_unbind() if _ffs_func_bind()
fails
On 07/07/2015 04:53 PM, Dan Carpenter wrote:
> 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.
Decrement is done in ffs_func_unbind() which is not called in this error
path. But after all I see another problem here, because we shouldn't
call functionfs_unbind() if refcnt after decrement is not equal zero. I
will fix it.
>
>> + functionfs_unbind(func->ffs);
Thanks,
Robert Baldyga
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists