diff options
author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2021-08-18 09:41:49 +0000 |
---|---|---|
committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2023-04-30 06:56:18 +0000 |
commit | fa65f958847ddb89639b6502286607c774015dea (patch) | |
tree | 277e69e7173e052c8cb37c6a9e144f09e702f9e5 | |
parent | 00e2c99eb73aca5e46940c7993631314d485713a (diff) | |
download | src-fa65f958847ddb89639b6502286607c774015dea.tar.gz src-fa65f958847ddb89639b6502286607c774015dea.zip |
Make sure the uftdi(4) driver doesn't start a USB transfer when being cancelled.
Sponsored by: NVIDIA Networking
(cherry picked from commit 8a46f021c2408c82375a1f5127efb7ac6b78596e)
-rw-r--r-- | sys/dev/usb/serial/uftdi.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/dev/usb/serial/uftdi.c b/sys/dev/usb/serial/uftdi.c index d57a2c5dbc45..5118a3affb84 100644 --- a/sys/dev/usb/serial/uftdi.c +++ b/sys/dev/usb/serial/uftdi.c @@ -1213,14 +1213,9 @@ uftdi_write_callback(struct usb_xfer *xfer, usb_error_t error) DPRINTFN(3, "\n"); switch (USB_GET_STATE(xfer)) { - default: /* Error */ - if (error != USB_ERR_CANCELLED) { - /* try to clear stall first */ - usbd_xfer_set_stall(xfer); - } - /* FALLTHROUGH */ case USB_ST_SETUP: case USB_ST_TRANSFERRED: +tr_setup: /* * If output packets don't require headers (the common case) we * can just load the buffer up with payload bytes all at once. @@ -1255,6 +1250,13 @@ uftdi_write_callback(struct usb_xfer *xfer, usb_error_t error) usbd_transfer_submit(xfer); } break; + default: /* Error */ + if (error != USB_ERR_CANCELLED) { + /* try to clear stall first */ + usbd_xfer_set_stall(xfer); + goto tr_setup; + } + break; } } |