Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Apr 2023 06:58:05 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: fa65f958847d - stable/13 - Make sure the uftdi(4) driver doesn't start a USB transfer when being cancelled.
Message-ID:  <202304300658.33U6w5Fh071764@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=fa65f958847ddb89639b6502286607c774015dea

commit fa65f958847ddb89639b6502286607c774015dea
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2021-08-18 09:41:49 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2023-04-30 06:56:18 +0000

    Make sure the uftdi(4) driver doesn't start a USB transfer when being cancelled.
    
    Sponsored by:   NVIDIA Networking
    
    (cherry picked from commit 8a46f021c2408c82375a1f5127efb7ac6b78596e)
---
 sys/dev/usb/serial/uftdi.c | 14 ++++++++------
 1 file 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;
 	}
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202304300658.33U6w5Fh071764>