]> Git Repo - J-linux.git/commitdiff
usb: raw-gadget: don't disable device if usb_ep_queue fails
authorAndrey Konovalov <[email protected]>
Thu, 26 Oct 2023 20:01:13 +0000 (22:01 +0200)
committerGreg Kroah-Hartman <[email protected]>
Fri, 27 Oct 2023 10:58:16 +0000 (12:58 +0200)
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 <[email protected]>
Link: https://lore.kernel.org/r/3c5df3dddb67623b4aeb11c5546370363e65d8e2.1698350424.git.andreyknvl@gmail.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/usb/gadget/legacy/raw_gadget.c

index ce9e87f849119e0c92eaaff4755947dc60daf609..daac1f0785169b5bd791cc501b91a68ffd595278 100644 (file)
@@ -693,7 +693,6 @@ static int raw_process_ep0_io(struct raw_dev *dev, struct usb_raw_ep_io *io,
                dev_err(&dev->gadget->dev,
                                "fail, usb_ep_queue returned %d\n", ret);
                spin_lock_irqsave(&dev->lock, flags);
-               dev->state = STATE_DEV_FAILED;
                goto out_queue_failed;
        }
 
@@ -1080,7 +1079,6 @@ static int raw_process_ep_io(struct raw_dev *dev, struct usb_raw_ep_io *io,
                dev_err(&dev->gadget->dev,
                                "fail, usb_ep_queue returned %d\n", ret);
                spin_lock_irqsave(&dev->lock, flags);
-               dev->state = STATE_DEV_FAILED;
                goto out_queue_failed;
        }
 
This page took 0.052099 seconds and 4 git commands to generate.