[lkml]   [2015]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCHv3 5/5] usb: gadget: udc-core: independent registration of gadgets and gadget drivers
On Wed, 11 Mar 2015, Ruslan Bilovol wrote:

> Hi Alan,


> > If you add the list_init and list_del_init above, this loop won't be
> > needed. You can just call list_del.
> I disagree with this. This function is externally visible and we can't
> guarantee that some buggy code will not call it with uninitialized
> 'pending' list_head. For example, if it never called usb_gadget_probe_driver()
> but calls usb_gadget_unregister_driver().
> As per my opinion it's better to check it and return -ENODEV rather than
> fail on deleting of uninitialized list_head. In this case adding the list_init
> and list_del_init above is not needed.

No, that is not the approach used in the rest of the kernel. We _want_
to know about bugs, so we can fix them. If you silently return -ENODEV
then nobody will realize anything is wrong, but a big fat WARN or OOPS
caused by an uninitialized list_head will draw people's attention very

Alan Stern

 \ /
  Last update: 2015-03-11 02:41    [W:0.048 / U:0.664 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site