diff options
Diffstat (limited to 'drivers/usb/wusbcore/wa-xfer.c')
-rw-r--r-- | drivers/usb/wusbcore/wa-xfer.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/usb/wusbcore/wa-xfer.c b/drivers/usb/wusbcore/wa-xfer.c index 6ccd93a..5f6df6e 100644 --- a/drivers/usb/wusbcore/wa-xfer.c +++ b/drivers/usb/wusbcore/wa-xfer.c @@ -83,12 +83,15 @@ #include <linux/spinlock.h> #include <linux/slab.h> #include <linux/hash.h> +#include <linux/ratelimit.h> +#include <linux/export.h> #include "wa-hc.h" #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 { @@ -442,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); @@ -1217,16 +1220,14 @@ static int wa_xfer_status_to_errno(u8 status) if (status == 0) return 0; if (status >= ARRAY_SIZE(xlat)) { - if (printk_ratelimit()) - printk(KERN_ERR "%s(): BUG? " + printk_ratelimited(KERN_ERR "%s(): BUG? " "Unknown WA transfer status 0x%02x\n", __func__, real_status); return -EINVAL; } errno = xlat[status]; if (unlikely(errno > 0)) { - if (printk_ratelimit()) - printk(KERN_ERR "%s(): BUG? " + printk_ratelimited(KERN_ERR "%s(): BUG? " "Inconsistent WA status: 0x%02x\n", __func__, real_status); errno = -errno; |