usb: dwc3: gadget: Check MaxPacketSize from descriptor
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Sat, 28 Jul 2018 01:52:41 +0000 (18:52 -0700)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 30 Jul 2018 07:39:20 +0000 (10:39 +0300)
endpoint->maxpacket is not updated after setting the
usb_set_maxpacket_limit() on endpoint enable. The MaxPacketSize can be
different than the endpoint->maxpacket_limit.

DWC3 has been consistently using MaxPacketSize from the endpoint's
descriptor, so let's keep it consistent and use the MaxPacketSize from
the endpoint's descriptor instead.

Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc3/gadget.c

index 69bf137aab378468a3c60a4f4932727ff2d83ee8..032ea7d709ba534907c6baf02bb3a634a4fa44f5 100644 (file)
@@ -1121,7 +1121,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
                                req->request.short_not_ok,
                                req->request.no_interrupt);
        } else if (req->request.zero && req->request.length &&
-                  (IS_ALIGNED(req->request.length,dep->endpoint.maxpacket))) {
+                  (IS_ALIGNED(req->request.length, maxp))) {
                struct dwc3     *dwc = dep->dwc;
                struct dwc3_trb *trb;