Skip to content

Commit

Permalink
usb: dwc3: gadget: fix high speed multiplier setting
Browse files Browse the repository at this point in the history
For High-Speed Transfers the prepare_one_trb function is calculating the
multiplier setting for the trb based on the length parameter of the trb
currently prepared. This assumption is wrong. For trbs with a sg list,
the length of the actual request has to be taken instead.

Fixes: 40d829f ("usb: dwc3: gadget: Correct ISOC DATA PIDs for short packets")
Cc: stable <stable@kernel.org>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220704141812.1532306-3-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Michael Grzeschik authored and Greg Kroah-Hartman committed Jul 8, 2022
1 parent 23385ce commit 8affe37
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/dwc3/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -1265,10 +1265,10 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
unsigned int mult = 2;
unsigned int maxp = usb_endpoint_maxp(ep->desc);

if (trb_length <= (2 * maxp))
if (req->request.length <= (2 * maxp))
mult--;

if (trb_length <= maxp)
if (req->request.length <= maxp)
mult--;

trb->size |= DWC3_TRB_SIZE_PCM1(mult);
Expand Down

0 comments on commit 8affe37

Please sign in to comment.