Re: [RESEND/PATCH] usb: gadget: goku_udc: Fix error path

From: Rahul Ruikar
Date: Mon Oct 04 2010 - 09:24:29 EST


Dan,

Following things I tried to do with this change.
there can be 3 cases where one need to handle device_register()
1) reaching error path but device_register() is never called..( ie,
error occurred before calling device_register() function call, in this
case "dev->reg_status" will have value "0" and in error handler
device_unregister() or put_device() will not be called.

2) error occurred at device_register() ( ie. it fails and calls error
handler, this way "dev->reg_status" will have value "2" and in error
handler, based on this value "put_device() will be called.

3) error occured after device_register() success. ( ie, error occured
due to some other function, ) in this case "dev->reg_status" will have
value "1" and in error handler, based on this value
"device_unregister" will be called.

but anyways someone has now proposed to change it to new usb
interface, so this patch is of no use now.

Thanks
Rahul Ruikar





On 4 October 2010 17:52, Dan Carpenter <error27@xxxxxxxxx> wrote:
> On Mon, Oct 04, 2010 at 01:29:00AM +0530, Rahul Ruikar wrote:
>> call put_device() when device_register() fails.
>>
>
> Sorry I didn't realize what you were trying to do here.  This is not
> correct at all.
>
> The right thing is to fix device_register() to call put_device() itself.
> It's a bit involved, because all the callers will need to be audited but
> someone is working on this I think.
>
> regards,
> dan carpenter
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/