Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: raw-gadget: don't disable device if usb_ep_queue fails

During device operation, the host might decide to reset a device emulated
via Raw Gadget. In this case, if the device emulation code has endpoint
requests queued, usb_ep_queue will fail with -ESHUTDOWN. Currently, this
disables the Raw Gadget device and makes the emulation code unable to
proceed.

Do not disable the Raw Gadget device if usb_ep_queue fails.

Signed-off-by: Andrey Konovalov <andreyknvl@gmail.com>
Link: https://lore.kernel.org/r/3c5df3dddb67623b4aeb11c5546370363e65d8e2.1698350424.git.andreyknvl@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Andrey Konovalov and committed by
Greg Kroah-Hartman
1f97e3f4 e8033bde

-2
-2
drivers/usb/gadget/legacy/raw_gadget.c
··· 693 693 dev_err(&dev->gadget->dev, 694 694 "fail, usb_ep_queue returned %d\n", ret); 695 695 spin_lock_irqsave(&dev->lock, flags); 696 - dev->state = STATE_DEV_FAILED; 697 696 goto out_queue_failed; 698 697 } 699 698 ··· 1079 1080 dev_err(&dev->gadget->dev, 1080 1081 "fail, usb_ep_queue returned %d\n", ret); 1081 1082 spin_lock_irqsave(&dev->lock, flags); 1082 - dev->state = STATE_DEV_FAILED; 1083 1083 goto out_queue_failed; 1084 1084 } 1085 1085