Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f030b7cf authored by Jack Pham's avatar Jack Pham Committed by Matt Wagantall
Browse files

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: default avatarJack Pham <jackp@codeaurora.org>
parent d9b8dd5d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment