[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1503102128260.25524-100000@netrider.rowland.org>
Date: Tue, 10 Mar 2015 21:31:39 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: Ruslan Bilovol <ruslan.bilovol@...il.com>
cc: "Balbi, Felipe" <balbi@...com>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Krzysztof Opasiak <k.opasiak@...sung.com>,
Peter Chen <peter.chen@...escale.com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
Andrzej Pietrasiewicz <andrzej.p@...sung.com>
Subject: Re: [PATCHv3 5/5] usb: gadget: udc-core: independent registration
of gadgets and gadget drivers
On Wed, 11 Mar 2015, Ruslan Bilovol wrote:
> Hi Alan,
Hello.
> > 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
quickly.
Alan Stern
--
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