Skip to content

Commit

Permalink
usb: gadget: f_tcm: Stop proceeding further on -ESHUTDOWN
Browse files Browse the repository at this point in the history
If the error code is -ESHUTDOWN, stop processing the request/command
further and prepare for teardown. -ESHUTDOWN is for device reset or
disconnection.

Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/b14410cce6bc7b8a0b43da23a8e0cf1ed1fa8ab6.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Thinh Nguyen authored and Greg Kroah-Hartman committed Dec 24, 2024
1 parent 89e4ec5 commit 2d6d0c6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/usb/gadget/function/f_tcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ static void bot_status_complete(struct usb_ep *ep, struct usb_request *req)
struct f_uas *fu = cmd->fu;

transport_generic_free_cmd(&cmd->se_cmd, 0);
if (req->status < 0) {
pr_err("ERR %s(%d)\n", __func__, __LINE__);
if (req->status == -ESHUTDOWN)
return;
}

if (req->status < 0)
pr_err("ERR %s(%d)\n", __func__, __LINE__);

/* CSW completed, wait for next CBW */
bot_enqueue_cmd_cbw(fu);
Expand Down Expand Up @@ -276,6 +277,9 @@ static void bot_cmd_complete(struct usb_ep *ep, struct usb_request *req)
struct f_uas *fu = req->context;
int ret;

if (req->status == -ESHUTDOWN)
return;

fu->flags &= ~USBG_BOT_CMD_PEND;

if (req->status < 0)
Expand Down

0 comments on commit 2d6d0c6

Please sign in to comment.