aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/usbtest.c
diff options
context:
space:
mode:
authorMathias Nyman <mathias.nyman@linux.intel.com>2016-05-02 04:39:03 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-05-03 17:32:07 -0400
commitcdc77c82a8286b1181b81b6e5ef60c8e83ded7bc (patch)
treec3eafc1c0e03d5154d43925cc279ffb84240e87c /drivers/usb/misc/usbtest.c
parent72f595f3b5cef2c36beb1d07409de58d9e503428 (diff)
usb: misc: usbtest: fix pattern tests for scatterlists.
The current implemenentation restart the sent pattern for each entry in the sg list. The receiving end expects a continuous pattern, and test will fail unless scatterilst entries happen to be aligned with the pattern Fix this by calculating the pattern byte based on total sent size instead of just the current sg entry. Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Fixes: 8b5249019352 ("[PATCH] USB: usbtest: scatterlist OUT data pattern testing") Cc: <stable@vger.kernel.org> # v2.6.18+ Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/misc/usbtest.c')
-rw-r--r--drivers/usb/misc/usbtest.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index de485d8a5beb..6b978f04b8d7 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -532,6 +532,7 @@ static struct scatterlist *
532alloc_sglist(int nents, int max, int vary, struct usbtest_dev *dev, int pipe) 532alloc_sglist(int nents, int max, int vary, struct usbtest_dev *dev, int pipe)
533{ 533{
534 struct scatterlist *sg; 534 struct scatterlist *sg;
535 unsigned int n_size = 0;
535 unsigned i; 536 unsigned i;
536 unsigned size = max; 537 unsigned size = max;
537 unsigned maxpacket = 538 unsigned maxpacket =
@@ -564,7 +565,8 @@ alloc_sglist(int nents, int max, int vary, struct usbtest_dev *dev, int pipe)
564 break; 565 break;
565 case 1: 566 case 1:
566 for (j = 0; j < size; j++) 567 for (j = 0; j < size; j++)
567 *buf++ = (u8) ((j % maxpacket) % 63); 568 *buf++ = (u8) (((j + n_size) % maxpacket) % 63);
569 n_size += size;
568 break; 570 break;
569 } 571 }
570 572