]> www.infradead.org Git - users/hch/misc.git/commitdiff
usb: gadget: f_tcm: Requeue command request on error
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Wed, 11 Dec 2024 00:34:09 +0000 (00:34 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Dec 2024 07:56:08 +0000 (08:56 +0100)
If there's error on command request, make sure to requeue to receive the
next one.

Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/d4e55c13be8f83f99ee55f7b979a99e2c14fc4c8.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_tcm.c

index 7ea48845f8c3c54926bba9f55c883a21eb3db01c..be7d8df360d936f169790d036643361f8e034952 100644 (file)
@@ -283,8 +283,13 @@ static void bot_cmd_complete(struct usb_ep *ep, struct usb_request *req)
 
        fu->flags &= ~USBG_BOT_CMD_PEND;
 
-       if (req->status < 0)
+       if (req->status < 0) {
+               struct usb_gadget *gadget = fuas_to_gadget(fu);
+
+               dev_err(&gadget->dev, "BOT command req err (%d)\n", req->status);
+               bot_enqueue_cmd_cbw(fu);
                return;
+       }
 
        ret = bot_submit_command(fu, req->buf, req->actual);
        if (ret) {