From: Christophe Lebouc <christophex.lebouc@xxxxxxxxx> This patch fixing the problem with large file transfers failing. Swap the read order to avoid unexpected RX status. Signed-off-by: Christophe Lebouc <christophex.lebouc@xxxxxxxxx> Signed-off-by: Hao Wu <hao.wu@xxxxxxxxx> Signed-off-by: Alan Cox <alan@xxxxxxxxxxxxxxx> --- drivers/usb/gadget/langwell_udc.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c index d297f9e..0643060 100644 --- a/drivers/usb/gadget/langwell_udc.c +++ b/drivers/usb/gadget/langwell_udc.c @@ -2440,12 +2440,14 @@ static int process_ep_req(struct langwell_udc *dev, int index, dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__); for (i = 0; i < curr_req->dtd_count; i++) { - remaining_length = le16_to_cpu(curr_dtd->dtd_total); - actual -= remaining_length; /* command execution states by dTD */ dtd_status = curr_dtd->dtd_status; + barrier(); + remaining_length = le16_to_cpu(curr_dtd->dtd_total); + actual -= remaining_length; + if (!dtd_status) { /* transfers completed successfully */ if (!remaining_length) { -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html