[PATCH 17/18] usb: gadget: u_serial: Put back to list if shutdown

Sascha Hauer s.hauer at pengutronix.de
Mon Mar 20 08:29:40 PDT 2023


We have to put the requests back to the read pool, even if they
are shut down, otherwise they are lost.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/usb/gadget/function/u_serial.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
index ac7a0b589d..ca4e77c5ff 100644
--- a/drivers/usb/gadget/function/u_serial.c
+++ b/drivers/usb/gadget/function/u_serial.c
@@ -155,12 +155,13 @@ static void gs_read_complete(struct usb_ep *ep, struct usb_request *req)
 {
 	struct gs_port	*port = ep->driver_data;
 
+	list_add_tail(&req->list, &port->read_pool);
+	port->read_nb_queued--;
+
 	if (req->status == -ESHUTDOWN)
 		return;
 
 	kfifo_put(port->recv_fifo, req->buf, req->actual);
-	list_add_tail(&req->list, &port->read_pool);
-	port->read_nb_queued--;
 
 	gs_start_rx(port);
 }
-- 
2.30.2




More information about the barebox mailing list