From patchwork Mon Apr 15 17:35:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Stern X-Patchwork-Id: 10901283 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 AD63E1515 for ; Mon, 15 Apr 2019 17:35:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 919EE284E8 for ; Mon, 15 Apr 2019 17:35:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 85BCA28960; Mon, 15 Apr 2019 17:35:48 +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.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 05F16284E8 for ; Mon, 15 Apr 2019 17:35:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727646AbfDORfr (ORCPT ); Mon, 15 Apr 2019 13:35:47 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:39814 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726956AbfDORfr (ORCPT ); Mon, 15 Apr 2019 13:35:47 -0400 Received: (qmail 5926 invoked by uid 2102); 15 Apr 2019 13:35:46 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 15 Apr 2019 13:35:46 -0400 Date: Mon, 15 Apr 2019 13:35:46 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Felipe Balbi cc: USB list Subject: [PATCH] USB: UDC: net22{80,72}: remove mistaken test of req->zero Message-ID: MIME-Version: 1.0 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 The net2280 UDC driver (and also net2272, probably via copy-and-paste) incorrectly checks the req->zero flag during OUT transfers, after copying data from the UDC's FIFO into memory. This makes no sense at all; the "zero" flag indicates that an extra zero-length packet should be appended to an IN transfer if the length is an even multiple of the maxpacket size. It has nothing to do with OUT transfers. In practice this doesn't cause any problems because gadget drivers never set req->zero for OUT transfers anyway. Still, it is an error and unnecessary code, so this patch removes the check. Signed-off-by: Alan Stern --- [as1887] drivers/usb/gadget/udc/net2272.c | 3 +-- drivers/usb/gadget/udc/net2280.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) Index: usb-devel/drivers/usb/gadget/udc/net2280.c =================================================================== --- usb-devel.orig/drivers/usb/gadget/udc/net2280.c +++ usb-devel/drivers/usb/gadget/udc/net2280.c @@ -789,8 +789,7 @@ static int read_fifo(struct net2280_ep * (void) readl(&ep->regs->ep_rsp); } - return is_short || ((req->req.actual == req->req.length) && - !req->req.zero); + return is_short || req->req.actual == req->req.length; } /* fill out dma descriptor to match a given request */ Index: usb-devel/drivers/usb/gadget/udc/net2272.c =================================================================== --- usb-devel.orig/drivers/usb/gadget/udc/net2272.c +++ usb-devel/drivers/usb/gadget/udc/net2272.c @@ -573,8 +573,7 @@ net2272_read_fifo(struct net2272_ep *ep, /* completion */ if (unlikely(cleanup || is_short || - ((req->req.actual == req->req.length) - && !req->req.zero))) { + req->req.actual == req->req.length)) { if (cleanup) { net2272_out_flush(ep);