UPSTREAM: usb: dwc3: ep0: Fix endianness of wIndex passed to dwc3_wIndex_to_dep
authorJohn Youn <johnyoun@synopsys.com>
Mon, 23 May 2016 18:32:38 +0000 (11:32 -0700)
committerHuang, Tao <huangtao@rock-chips.com>
Tue, 16 Aug 2016 12:48:19 +0000 (20:48 +0800)
The wIndex passed in here is CPU endianness, but the function expects
little endian.

Found with sparse.

Change-Id: Ib33f0b9b4e8c3320eb590496460e2cc7274b6a0e
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 958b9fa7f8cfd5799534e98ba3d05d96a5e7ccb9)

drivers/usb/dwc3/ep0.c

index dfe3ec71c7f326834be55e2640bbc200b488ff87..0dc057500ff2627152f74a510e752d80c2215651 100644 (file)
@@ -493,7 +493,7 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc,
        case USB_RECIP_ENDPOINT:
                switch (wValue) {
                case USB_ENDPOINT_HALT:
-                       dep = dwc3_wIndex_to_dep(dwc, wIndex);
+                       dep = dwc3_wIndex_to_dep(dwc, ctrl->wIndex);
                        if (!dep)
                                return -EINVAL;
                        if (set == 0 && (dep->flags & DWC3_EP_WEDGE))