diff options
author | Jack Pham <jackp@codeaurora.org> | 2014-10-21 19:31:10 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-10-23 14:57:24 -0400 |
commit | 1200a82a59b6aa65758ccc92c3447b98c53cd7a2 (patch) | |
tree | 9d12eba3924c789e1b10c9ff2039ca9198f0df7c | |
parent | 32805c350bad16e7d4debe55820d2e79dca89fb6 (diff) |
usb: dwc3: gadget: Properly initialize LINK TRB
On ISOC endpoints the last trb_pool entry used as a
LINK TRB is not getting zeroed out correctly due to
memset being called incorrectly and in the wrong place.
If pool allocated from DMA was not zero-initialized
to begin with this will result in the size and ctrl
values being random garbage. Call memset correctly after
assignment of the trb_link pointer.
Fixes: f6bafc6a1c ("usb: dwc3: convert TRBs into bitshifts")
Cc: <stable@vger.kernel.org> # v3.4+
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/dwc3/gadget.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index f6d1dbafa298..546ea5431b8c 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -525,12 +525,11 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, | |||
525 | if (!usb_endpoint_xfer_isoc(desc)) | 525 | if (!usb_endpoint_xfer_isoc(desc)) |
526 | return 0; | 526 | return 0; |
527 | 527 | ||
528 | memset(&trb_link, 0, sizeof(trb_link)); | ||
529 | |||
530 | /* Link TRB for ISOC. The HWO bit is never reset */ | 528 | /* Link TRB for ISOC. The HWO bit is never reset */ |
531 | trb_st_hw = &dep->trb_pool[0]; | 529 | trb_st_hw = &dep->trb_pool[0]; |
532 | 530 | ||
533 | trb_link = &dep->trb_pool[DWC3_TRB_NUM - 1]; | 531 | trb_link = &dep->trb_pool[DWC3_TRB_NUM - 1]; |
532 | memset(trb_link, 0, sizeof(*trb_link)); | ||
534 | 533 | ||
535 | trb_link->bpl = lower_32_bits(dwc3_trb_dma_offset(dep, trb_st_hw)); | 534 | trb_link->bpl = lower_32_bits(dwc3_trb_dma_offset(dep, trb_st_hw)); |
536 | trb_link->bph = upper_32_bits(dwc3_trb_dma_offset(dep, trb_st_hw)); | 535 | trb_link->bph = upper_32_bits(dwc3_trb_dma_offset(dep, trb_st_hw)); |