[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211208100545.1441397-4-neal_liu@aspeedtech.com>
Date: Wed, 8 Dec 2021 18:05:44 +0800
From: Neal Liu <neal_liu@...eedtech.com>
To: Felipe Balbi <balbi@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Joel Stanley <joel@....id.au>,
Andrew Jeffery <andrew@...id.au>,
Cai Huoqing <caihuoqing@...du.com>,
Tao Ren <rentao.bupt@...il.com>,
Julia Lawall <julia.lawall@...ia.fr>,
"kernel test robot" <lkp@...el.com>,
Sasha Levin <sashal@...nel.org>, <linux-usb@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-aspeed@...ts.ozlabs.org>, <benh@...nel.crashing.org>
CC: Neal Liu <neal_liu@...eedtech.com>, <BMC-SW@...eedtech.com>
Subject: [PATCH v3 3/4] usb: aspeed-vhub: fix ep0 OUT ack received wrong length issue
If multiple devices in vhub are enumerated simultaneously, ep0 OUT
ack might received wrong data length. Using expected data length
instead.
Acked-by: Benjamin Herrenschmidt <benh@...nel.crashing.org>
Signed-off-by: Neal Liu <neal_liu@...eedtech.com>
---
drivers/usb/gadget/udc/aspeed-vhub/ep0.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/usb/gadget/udc/aspeed-vhub/ep0.c b/drivers/usb/gadget/udc/aspeed-vhub/ep0.c
index 74ea36c19b1e..b4cf46249fea 100644
--- a/drivers/usb/gadget/udc/aspeed-vhub/ep0.c
+++ b/drivers/usb/gadget/udc/aspeed-vhub/ep0.c
@@ -251,6 +251,13 @@ static void ast_vhub_ep0_do_receive(struct ast_vhub_ep *ep, struct ast_vhub_req
len = remain;
rc = -EOVERFLOW;
}
+
+ /* Hardware return wrong data len */
+ if (len < ep->ep.maxpacket && len != remain) {
+ EPDBG(ep, "using expected data len instead\n");
+ len = remain;
+ }
+
if (len && req->req.buf)
memcpy(req->req.buf + req->req.actual, ep->buf, len);
req->req.actual += len;
--
2.25.1
Powered by blists - more mailing lists