]> git.hungrycats.org Git - linux/commitdiff
usb: wusbcore: change WA_SEGS_MAX to a legal value
authorThomas Pugliese <thomas.pugliese@gmail.com>
Wed, 23 Oct 2013 19:44:29 +0000 (14:44 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Apr 2014 13:44:28 +0000 (06:44 -0700)
commit f74b75e7f920c700636cccca669c7d16d12e9202 upstream.

change WA_SEGS_MAX to a number that is legal according to the WUSB
spec.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/wusbcore/wa-xfer.c

index 57c01ab09ad85209cedc966e90a3be2d94cb90f7..5f6df6ee6ab66c42d5c2621bac05c3b69efadaaf 100644 (file)
@@ -90,7 +90,8 @@
 #include "wusbhc.h"
 
 enum {
-       WA_SEGS_MAX = 255,
+       /* [WUSB] section 8.3.3 allocates 7 bits for the segment index. */
+       WA_SEGS_MAX = 128,
 };
 
 enum wa_seg_status {
@@ -444,7 +445,7 @@ static ssize_t __wa_xfer_setup_sizes(struct wa_xfer *xfer,
        xfer->seg_size = (xfer->seg_size / maxpktsize) * maxpktsize;
        xfer->segs = (urb->transfer_buffer_length + xfer->seg_size - 1)
                / xfer->seg_size;
-       if (xfer->segs >= WA_SEGS_MAX) {
+       if (xfer->segs > WA_SEGS_MAX) {
                dev_err(dev, "BUG? ops, number of segments %d bigger than %d\n",
                        (int)(urb->transfer_buffer_length / xfer->seg_size),
                        WA_SEGS_MAX);