Commit 55168470 authored by Felipe Balbi's avatar Felipe Balbi

usb: dwc3: ep0: fix DMA starvation by assigning req->trb on ep0

If we don't assign a TRB to ep0 requests, we won't be able to unmap
the request later on resulting in starvation of DMA resources.

Fixes: 4a71fcb8 ("usb: dwc3: gadget: only unmap requests from DMA if mapped")
Reported-by: default avatarThinh Nguyen <Thinh.Nguyen@synopsys.com>
Tested-by: default avatarThinh Nguyen <Thinh.Nguyen@synopsys.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 2bd6bf03
......@@ -990,6 +990,8 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,
DWC3_TRBCTL_CONTROL_DATA,
true);
req->trb = &dwc->ep0_trb[dep->trb_enqueue - 1];
/* Now prepare one extra TRB to align transfer size */
dwc3_ep0_prepare_one_trb(dep, dwc->bounce_addr,
maxpacket - rem,
......@@ -1015,6 +1017,8 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,
DWC3_TRBCTL_CONTROL_DATA,
true);
req->trb = &dwc->ep0_trb[dep->trb_enqueue - 1];
/* Now prepare one extra TRB to align transfer size */
dwc3_ep0_prepare_one_trb(dep, dwc->bounce_addr,
0, DWC3_TRBCTL_CONTROL_DATA,
......@@ -1029,6 +1033,9 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,
dwc3_ep0_prepare_one_trb(dep, req->request.dma,
req->request.length, DWC3_TRBCTL_CONTROL_DATA,
false);
req->trb = &dwc->ep0_trb[dep->trb_enqueue];
ret = dwc3_ep0_start_trans(dep);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment