Received: by 10.223.164.200 with SMTP id h8csp912371wrb; Mon, 6 Nov 2017 00:46:58 -0800 (PST) X-Google-Smtp-Source: ABhQp+TGbPg0OpLX1T3VswCPrhCGdobYGjeApygUfeWT8VoWKeFa8B2aDasgYreOMpKNFuCU010b X-Received: by 10.84.225.145 with SMTP id u17mr13863106plj.369.1509958018077; Mon, 06 Nov 2017 00:46:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509958018; cv=none; d=google.com; s=arc-20160816; b=GS0L3X+HFvEuNAP3XX6O0gClUTyqi4yEWyS2UbOGOTpxlGg7GggiG9sqjRMPmuK/27 Xk7/riwkp10jgY6vOvKnO5SR16px5hhW7NTR540ogYwJh/mUhGAXD6PXNovtw3WYdezQ ic0HGgcryw6z9AcvLs7HMq2lw1o7UL1peT+V2u+QAsYP1GEdo45x8G+hR+BFGSV8NeZe Xim7lb+8pXFOLXzoAf9ndWrjlTq73GBq0TldYZWCp9qZ+5hh2rEeRbbCPhGOZ9blFoyo Ro57sAQJt+sZqTZskRygFla5NCea3ils9x/qA/XsmOqOgRFUzZZ54mpl+b8hDpb+bYD9 v6gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:arc-authentication-results; bh=q0Uv2UBKDhWTRdmEMsDmm9fL7du+vTr0oQDMI7SsDVA=; b=K0UUjOkU9wrxJ9TgrFpd6VStZMxC60hYOapWjgKPkEvlAfoKxSCJgsHqQLQMqJO/vn uciGZasSJZo+IB44xg7RQCNU4N5rte5m5lI5fJDruF7i5htIEr5Ft+fclcoTW1WqrPfM S4TubSr5gm20Mwu9lPHXegtMptwVAGDUMOl16tGN4O5BN5C0wwVTYfRfspXVhgvknDST Q86HYV99Dp4SDfIfMMThligQLrwZmps5SYp7cvDHmjsMV0ZUKGDn90OmiNU4Js+6U02A vj3XXlBSd7gqMFSFtyZt+nQ+5D1cQVXSwl85GbREQXeyqTpxFpR5c4I8jGZwmp5AZoJt RQMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g192si12026661pfc.29.2017.11.06.00.46.43; Mon, 06 Nov 2017 00:46:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751884AbdKFIqH (ORCPT + 98 others); Mon, 6 Nov 2017 03:46:07 -0500 Received: from regular1.263xmail.com ([211.150.99.136]:40954 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750739AbdKFIqG (ORCPT ); Mon, 6 Nov 2017 03:46:06 -0500 Received: from william.wu?rock-chips.com (unknown [192.168.167.158]) by regular1.263xmail.com (Postfix) with ESMTP id 32AB059; Mon, 6 Nov 2017 16:45:54 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id 7F604308; Mon, 6 Nov 2017 16:45:52 +0800 (CST) X-RL-SENDER: william.wu@rock-chips.com X-FST-TO: john.youn@synopsys.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: william.wu@rock-chips.com X-UNIQUE-TAG: <95b4a592a446b8f0e17ff67ad9e87029> X-ATTACHMENT-NUM: 0 X-SENDER: wulf@rock-chips.com X-DNS-TYPE: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 20459KBHG4C; Mon, 06 Nov 2017 16:45:54 +0800 (CST) From: William Wu To: John.Youn@synopsys.com, balbi@kernel.org, gregkh@linuxfoundation.org Cc: heiko@sntech.de, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-rockchip@lists.infradead.org, frank.wang@rock-chips.com, huangtao@rock-chips.com, dianders@google.com, daniel.meng@rock-chips.com, william.wu@rock-chips.com, fml@rock-chips.com Subject: [PATCH] usb: dwc2: host: fix isoc urb actual length Date: Mon, 6 Nov 2017 16:45:39 +0800 Message-Id: <1509957939-31786-1-git-send-email-william.wu@rock-chips.com> X-Mailer: git-send-email 2.0.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The actual_length in dwc2_hcd_urb structure is used to indicate the total data length transferred so far, but in dwc2_update_isoc_urb_state(), it just updates the actual_length of isoc frame, and don't update the urb actual_length at the same time, this will cause device drivers working error which depend on the urb actual_length. we can easily find this issue if use an USB camera, the userspace use libusb to get USB data from kernel via devio driver.In usb devio driver, processcompl() function will process urb complete and copy data to userspace depending on urb actual_length. Let's update the urb actual_length if the isoc frame is valid. Signed-off-by: William Wu --- drivers/usb/dwc2/hcd_intr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c index 28a8210..01b1e13 100644 --- a/drivers/usb/dwc2/hcd_intr.c +++ b/drivers/usb/dwc2/hcd_intr.c @@ -580,6 +580,7 @@ static enum dwc2_halt_status dwc2_update_isoc_urb_state( frame_desc->status = 0; frame_desc->actual_length = dwc2_get_actual_xfer_length(hsotg, chan, chnum, qtd, halt_status, NULL); + urb->actual_length += frame_desc->actual_length; break; case DWC2_HC_XFER_FRAME_OVERRUN: urb->error_count++; @@ -599,6 +600,7 @@ static enum dwc2_halt_status dwc2_update_isoc_urb_state( frame_desc->status = -EPROTO; frame_desc->actual_length = dwc2_get_actual_xfer_length(hsotg, chan, chnum, qtd, halt_status, NULL); + urb->actual_length += frame_desc->actual_length; /* Skip whole frame */ if (chan->qh->do_split && -- 2.0.0 From 1583428053022059359@xxx Tue Nov 07 17:11:06 +0000 2017 X-GM-THRID: 1583428053022059359 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread