On Wed, 7 Dec 2016, Krzysztof Opasiak wrote: > If we found a matching driver but its bind() function failed for some > reason, let's continue our search as there may be some other gadget > pending on a list which bind() will succeed for this udc. > > Reported-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> > Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx> > --- > drivers/usb/gadget/udc/core.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c > index a83e6017a8b0..b02a166ba380 100644 > --- a/drivers/usb/gadget/udc/core.c > +++ b/drivers/usb/gadget/udc/core.c > @@ -1083,16 +1083,22 @@ static void usb_udc_nop_release(struct device *dev) > /* should be called with udc_lock held */ > static int check_pending_gadget_drivers(struct usb_udc *udc) > { > - struct usb_gadget_driver *driver; > + struct usb_gadget_driver *driver, *tmp; > int ret = 0; > > - list_for_each_entry(driver, &gadget_driver_pending_list, pending) > + list_for_each_entry_safe(driver, tmp, &gadget_driver_pending_list, > + pending) > if (!driver->udc_name || strcmp(driver->udc_name, > dev_name(&udc->dev)) == 0) { > ret = udc_bind_to_driver(udc, driver); > + if (ret == 0) > + break; > if (ret != -EPROBE_DEFER) > list_del_init(&driver->pending); These two tests are in the wrong order. You should call list_del_init() even when ret == 0. > - break; > + /* > + * We failed to bind this driver, so let's try > + * next one. > + */ > } > > return ret; Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html