]> git.baikalelectronics.ru Git - kernel.git/commit
usb: dwc3: gadget: Fix TRB preparation during SG
authorAmit Virdi <amit.virdi@st.com>
Tue, 13 Jan 2015 08:57:20 +0000 (14:27 +0530)
committerFelipe Balbi <balbi@ti.com>
Wed, 14 Jan 2015 17:28:23 +0000 (11:28 -0600)
commit942d98920db2de314a9d62097d25a4aff5e228fc
tree9c157dbcf904459896018942212d8ed559534a3e
parentf3e2d23b0b9341ec8199298ac66c450b9b86204f
usb: dwc3: gadget: Fix TRB preparation during SG

When scatter gather (SG) is used, multiple TRBs are prepared from one DWC3
request (dwc3_request). So while preparing TRBs, the 'last' flag should be set
only when it is the last TRB being prepared from the last dwc3_request entry.

The current implementation uses list_is_last to check if the dwc3_request is the
last entry from the request_list. However, list_is_last returns false for the
last entry too. This is because, while preparing the first TRB from a request,
the function dwc3_prepare_one_trb modifies the request's next and prev pointers
while moving the URB to req_queued. Hence, list_is_last always returns false no
matter what.

The correct way is not to access the modified pointers of dwc3_request but to
use list_empty macro instead.

Fixes: 703d5f3ead4f (usb: dwc3: gadget: fix scatter gather implementation)
Signed-off-by: Amit Virdi <amit.virdi@st.com>
Cc: <stable@vger.kernel.org> # v3.9+
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/dwc3/gadget.c