From: William Wu <william.wu@rock-chips.com>
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 [thread overview]
Message-ID: <1509957939-31786-1-git-send-email-william.wu@rock-chips.com> (raw)
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 <william.wu@rock-chips.com>
---
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
next reply other threads:[~2017-11-06 8:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-06 8:45 William Wu [this message]
2017-11-06 9:28 ` Minas Harutyunyan
2017-11-06 10:08 ` wlf
2017-11-06 12:30 ` Minas Harutyunyan
2017-11-06 19:17 ` Alan Stern
2017-11-07 9:58 ` wlf
2017-11-07 15:18 ` Alan Stern
2017-11-08 2:58 ` wlf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1509957939-31786-1-git-send-email-william.wu@rock-chips.com \
--to=william.wu@rock-chips.com \
--cc=John.Youn@synopsys.com \
--cc=balbi@kernel.org \
--cc=daniel.meng@rock-chips.com \
--cc=dianders@google.com \
--cc=fml@rock-chips.com \
--cc=frank.wang@rock-chips.com \
--cc=gregkh@linuxfoundation.org \
--cc=heiko@sntech.de \
--cc=huangtao@rock-chips.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®