Commit e157f561 authored by Thomas Pugliese's avatar Thomas Pugliese Committed by Greg Kroah-Hartman

usb: wusbcore: change WA_SEGS_MAX to a legal value

commit f74b75e7 upstream.

change WA_SEGS_MAX to a number that is legal according to the WUSB
spec.
Signed-off-by: default avatarThomas Pugliese <thomas.pugliese@gmail.com>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
Cc: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bec174d1
...@@ -90,7 +90,8 @@ ...@@ -90,7 +90,8 @@
#include "wusbhc.h" #include "wusbhc.h"
enum { 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 { enum wa_seg_status {
...@@ -444,7 +445,7 @@ static ssize_t __wa_xfer_setup_sizes(struct wa_xfer *xfer, ...@@ -444,7 +445,7 @@ static ssize_t __wa_xfer_setup_sizes(struct wa_xfer *xfer,
xfer->seg_size = (xfer->seg_size / maxpktsize) * maxpktsize; xfer->seg_size = (xfer->seg_size / maxpktsize) * maxpktsize;
xfer->segs = (urb->transfer_buffer_length + xfer->seg_size - 1) xfer->segs = (urb->transfer_buffer_length + xfer->seg_size - 1)
/ xfer->seg_size; / 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", dev_err(dev, "BUG? ops, number of segments %d bigger than %d\n",
(int)(urb->transfer_buffer_length / xfer->seg_size), (int)(urb->transfer_buffer_length / xfer->seg_size),
WA_SEGS_MAX); WA_SEGS_MAX);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment