From patchwork Sat Jul 28 01:52:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 10547853 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 57730112B for ; Sat, 28 Jul 2018 01:52:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C2E420415 for ; Sat, 28 Jul 2018 01:52:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C5992C570; Sat, 28 Jul 2018 01:52:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D29820415 for ; Sat, 28 Jul 2018 01:52:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389091AbeG1DRP (ORCPT ); Fri, 27 Jul 2018 23:17:15 -0400 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9]:39700 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388894AbeG1DRP (ORCPT ); Fri, 27 Jul 2018 23:17:15 -0400 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 03DF224E101F; Fri, 27 Jul 2018 18:52:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1532742763; bh=MqstAurPgtv0TCye88GUXbkeseGE2xOzeOd6bYfOj3c=; h=Date:From:Subject:To:CC:From; b=EWGNGAGwn8piC7mB7kdSO8c/75QdRoRLlyCdqSXs0+7DVJwOeAHvvFafmUDOdDFdI DNQK3T0GXY6h+RFl+3J7XQBZNNiv9kpezjvIL0Y00paqIOhbZ+E4+GAf7nTIVFHqLw unuBqFxi3jyU+2cJuSPha4A0zUiBExAm+RbbMSM8qpk4pHXVMviwApQyTzdeHcWwH1 ooVDadqMh9FZQRezzvtkXc52iSYNIcEpn5UO147aWfzI97GdlpK1imAjT758HmTjys hfPzaSjo94DaA9fw71Ixqpyokgx9WHiCik3Mst5cM7vkP/hlqA/j0NxLP4AdwR/Gf4 NkMPzITuH0Qqg== Received: from us01wehtc1.internal.synopsys.com (us01wehtc1-vip.internal.synopsys.com [10.12.239.236]) by mailhost.synopsys.com (Postfix) with ESMTP id E48AB3F55; Fri, 27 Jul 2018 18:52:42 -0700 (PDT) Received: from US01WEHTC3.internal.synopsys.com (10.15.84.232) by us01wehtc1.internal.synopsys.com (10.12.239.235) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 27 Jul 2018 18:52:42 -0700 Received: from te-lab16 (10.13.184.20) by US01WEHTC3.internal.synopsys.com (10.15.84.231) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 27 Jul 2018 18:52:41 -0700 Received: by te-lab16 (sSMTP sendmail emulation); Fri, 27 Jul 2018 18:52:41 -0700 Date: Fri, 27 Jul 2018 18:52:41 -0700 Message-ID: <437a32ebba5bedbae4f6be1a43c1174f4e596f76.1532742607.git.thinhn@synopsys.com> From: Thinh Nguyen Subject: [PATCH 1/3] usb: dwc3: gadget: Check MaxPacketSize from descriptor To: Felipe Balbi , CC: John Youn MIME-Version: 1.0 X-Originating-IP: [10.13.184.20] Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/usb/dwc3/gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 69bf137aab37..032ea7d709ba 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -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;