On Sat, May 20, 2023 at 01:34:43PM +0300, Dan Carpenter wrote: > Hello Alan Stern, > > The patch 1016fc0c096c: "USB: gadget: Fix obscure lockdep violation > for udc_mutex" from Aug 26, 2022, leads to the following Smatch > static checker warning: > > drivers/usb/gadget/udc/core.c:767 usb_gadget_disconnect() > warn: sleeping in atomic context > > drivers/usb/gadget/udc/core.c > 757 * Gadget will stay disconnected after activation. > 758 */ > 759 gadget->connected = false; > 760 goto out; > 761 } > 762 > 763 ret = gadget->ops->pullup(gadget, 0); > 764 if (!ret) > 765 gadget->connected = 0; > 766 > --> 767 mutex_lock(&udc_lock); > 768 if (gadget->udc->driver) > 769 gadget->udc->driver->disconnect(gadget); > 770 mutex_unlock(&udc_lock); > 771 > > The call tree where we're holding a spinlock is: > > max3420_vbus_handler() <- disables preempt > -> usb_udc_vbus_handler() > -> usb_udc_connect_control() > -> usb_gadget_disconnect() Indeed, I've been discussing this issue with Badhri Jagan Sridharan. See these threads for more information: https://lore.kernel.org/linux-usb/20230517115955.1078339-1-badhri@xxxxxxxxxx/#r https://lore.kernel.org/linux-usb/20230519043041.1593578-1-badhri@xxxxxxxxxx/#r Alan Stern