> > @@ -348,23 +356,14 @@ static void usb_gadget_remove_driver(struct
> usb_udc *udc)
> > */
> > void usb_del_gadget_udc(struct usb_gadget *gadget) {
> > - struct usb_udc *udc = NULL;
> > -
> > - mutex_lock(&udc_lock);
> > - list_for_each_entry(udc, &udc_list, list)
> > - if (udc->gadget == gadget)
> > - goto found;
> > -
> > - dev_err(gadget->dev.parent, "gadget not registered.\n");
> > - mutex_unlock(&udc_lock);
> > + struct usb_udc *udc = usb_gadget_find_udc(gadget);
> >
> > - return;
> > + if (!udc)
> > + return;
> >
> > -found:
> > dev_vdbg(gadget->dev.parent, "unregistering gadget\n");
> >
> > list_del(&udc->list);
> > - mutex_unlock(&udc_lock);
>
> I believe udc->list linkage to udc_list still should be protected with
> udc_lock,
> otherwise this will race with usb_add_gadget_udc_release().
>
Thanks, it indeed should be.
Peter
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html