usb: dwc3: gadget: Fix calculation of request.actual for SG
When a request completes, cleanup_done_trbs() tries to calculate
request.actual by subtracting the TRB remainder from the original
request.length, but does not account for scatter-gather requests
that queued multiple TRBs. In this case, the request.length field
may be used by the function to keep track of the aggregate length
of all the provided SG entries, and thus will produce an incorrect
request.actual. Instead, for scatter-gather, to find the pre-transfer
buffer length of each TRB, get the length field of each SG entry.
Then the number of bytes transfered can be correctly determined as
the difference between that and the bytes remaining in the TRB.
Change-Id: I4c197462ce5b804c9d684240e95c35b532976220
Signed-off-by:
Jack Pham <jackp@codeaurora.org>
Loading
Please register or sign in to comment