xhci: rework inc_deq() and fix off by one error.
authorMathias Nyman <mathias.nyman@linux.intel.com>
Tue, 21 Jun 2016 07:58:05 +0000 (10:58 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 26 Jun 2016 18:43:39 +0000 (11:43 -0700)
commitbd5e67f59a2e26d8c342590df2d0936c237d8f1a
treed4bcf38d8bbdbf2e3a07d0ea6a463ad5ebfbb74b
parent2d98ef406f17ec3cfc196dc65c0e53d7fab8671b
xhci: rework inc_deq() and fix off by one error.

inc_deq() is called both for rings with link trbs and the event ring
without link trbs.
The last_trb() check in inc_deq() has a off by one error, going beyond
allocated array when checking if trb == [TRBS_PER_SEGMENT], and the whole
inc_deq() depend on this.

Rewrite the inc_deq() funciton, remove the faulty last_trb() helper, add
new last_trb_on_seg() and last_trb_on_ring() helpers

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-ring.c