]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
xhci: Fix errors in the running total calculations in the TRB math
authorPaul Zimmerman <Paul.Zimmerman@synopsys.com>
Sat, 12 Feb 2011 22:07:20 +0000 (14:07 -0800)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Sun, 26 Jun 2011 16:46:52 +0000 (12:46 -0400)
commit31331bfac21cfeef1064dc94bf955f76e91a93c4
tree857f3d18ff289f87ef4f00a157bc2fc5ddf459f8
parentdeee88a9137ec28499aa6882050accee2175d718
xhci: Fix errors in the running total calculations in the TRB math

commit 5807795bd4dececdf553719cc02869e633395787 upstream.

Calculations like

running_total = TRB_MAX_BUFF_SIZE -
(sg_dma_address(sg) & (TRB_MAX_BUFF_SIZE - 1));
if (running_total != 0)
num_trbs++;

are incorrect, because running_total can never be zero, so the if()
expression will never be true. I think the intention was that
running_total be in the range of 0 to TRB_MAX_BUFF_SIZE-1, not 1
to TRB_MAX_BUFF_SIZE. So adding a

running_total &= TRB_MAX_BUFF_SIZE - 1;

fixes the problem.

This patch should be queued for stable kernels back to 2.6.31.

[PG: 34 doesn't have count_isoc_trbs_needed() hence this has
only two of the three upstream running_total changes.]

Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
drivers/usb/host/xhci-ring.c