提交 415fa1c7 编写于 作者: G Guenter Roeck 提交者: Greg Kroah-Hartman

usb: dwc2: Do not update data length if it is 0 on inbound transfers

The DWC2 documentation states that transfers with zero data length should
set the number of packets to 1 and the transfer length to 0. This is not
currently the case for inbound transfers: the transfer length is set to
the maximum packet length. This can have adverse effects if the chip
actually does transfer data as it is programmed to do. Follow chip
documentation and keep the transfer length set to 0 in that situation.

Fixes: 56f5b1cf ("staging: Core files for the DWC2 driver")
Tested-by: NNicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: NDouglas Anderson <dianders@chromium.org>
Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
Signed-off-by: NNicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20210113112052.17063-2-nsaenzjulienne@suse.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 7961b77c
......@@ -1313,19 +1313,20 @@ static void dwc2_hc_start_transfer(struct dwc2_hsotg *hsotg,
if (num_packets > max_hc_pkt_count) {
num_packets = max_hc_pkt_count;
chan->xfer_len = num_packets * chan->max_packet;
} else if (chan->ep_is_in) {
/*
* Always program an integral # of max packets
* for IN transfers.
* Note: This assumes that the input buffer is
* aligned and sized accordingly.
*/
chan->xfer_len = num_packets * chan->max_packet;
}
} else {
/* Need 1 packet for transfer length of 0 */
num_packets = 1;
}
if (chan->ep_is_in)
/*
* Always program an integral # of max packets for IN
* transfers
*/
chan->xfer_len = num_packets * chan->max_packet;
if (chan->ep_type == USB_ENDPOINT_XFER_INT ||
chan->ep_type == USB_ENDPOINT_XFER_ISOC)
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册