Hi, >> > It is likely that this bug occurs because you don't use a spinlock in >> > kagen2_ep_queue. Does the interrupt handler routine use a spinlock? >> >> Spinlock is Not used in interrupt handler routine. > > Then that's the reason for this bug. > >> >[start_transfer] 53425355 10d >> >ept1 out queue len 0x200, buffer 0xc1304000 >> >g_file_storage gadget: bulk-out, length 31: >> >> Is the kagen2_ep_queue function gotten interrupted here? So the >> kagen2_ep_queue and interrupt routine need spinlock for >> synchronisation? > > That's right. Interrupts can occur at almost any time (on > multiprocessor systems they can occur even when interrupts are disabled > on some of the CPUs). I am confused. I add the spinlock functions to kagen2_ep_queue function. spin_lock_irqsave(&dev->lock, flags); ...... spin_unlock_irqrestore(&dev->lock, flags); When kagen2_ep_queue function is called, the error "BUG: scheduling while atomic: swapper/0/0x00000002" occurs. I test the same spinlock functions in other device module. It is ok in other device module. thanks, victor -- 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