]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.4/usb-gadget-fix-request-length-error-for-isoc-transfer.patch
drop drm-rockchip-shutdown-drm-subsystem-on-shutdown.patch from 4.4.y and 4.9.y
[thirdparty/kernel/stable-queue.git] / queue-4.4 / usb-gadget-fix-request-length-error-for-isoc-transfer.patch
CommitLineData
178a796d
GKH
1From 982555fc26f9d8bcdbd5f9db0378fe0682eb4188 Mon Sep 17 00:00:00 2001
2From: Peter Chen <peter.chen@nxp.com>
3Date: Tue, 8 Nov 2016 10:08:24 +0800
4Subject: usb: gadget: fix request length error for isoc transfer
5
6From: Peter Chen <peter.chen@nxp.com>
7
8commit 982555fc26f9d8bcdbd5f9db0378fe0682eb4188 upstream.
9
10For isoc endpoint descriptor, the wMaxPacketSize is not real max packet
11size (see Table 9-13. Standard Endpoint Descriptor, USB 2.0 specifcation),
12it may contain the number of packet, so the real max packet should be
13ep->desc->wMaxPacketSize && 0x7ff.
14
15Cc: Felipe F. Tonello <eu@felipetonello.com>
16Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
17Fixes: 16b114a6d797 ("usb: gadget: fix usb_ep_align_maybe
18 endianness and new usb_ep_aligna")
19
20Signed-off-by: Peter Chen <peter.chen@nxp.com>
21Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
22Signed-off-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
23Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24
25---
26 include/linux/usb/gadget.h | 4 +++-
27 1 file changed, 3 insertions(+), 1 deletion(-)
28
29--- a/include/linux/usb/gadget.h
30+++ b/include/linux/usb/gadget.h
31@@ -671,7 +671,9 @@ static inline struct usb_gadget *dev_to_
32 */
33 static inline size_t usb_ep_align(struct usb_ep *ep, size_t len)
34 {
35- return round_up(len, (size_t)le16_to_cpu(ep->desc->wMaxPacketSize));
36+ int max_packet_size = (size_t)usb_endpoint_maxp(ep->desc) & 0x7ff;
37+
38+ return round_up(len, max_packet_size);
39 }
40
41 /**