1
0
Fork 0

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: 8b52490193 ("[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>
hifive-unleashed-5.1
Mathias Nyman 2016-05-02 11:39:03 +03:00 committed by Greg Kroah-Hartman
parent 72f595f3b5
commit cdc77c82a8
1 changed files with 3 additions and 1 deletions

View File

@ -532,6 +532,7 @@ static struct scatterlist *
alloc_sglist(int nents, int max, int vary, struct usbtest_dev *dev, int pipe)
{
struct scatterlist *sg;
unsigned int n_size = 0;
unsigned i;
unsigned size = max;
unsigned maxpacket =
@ -564,7 +565,8 @@ alloc_sglist(int nents, int max, int vary, struct usbtest_dev *dev, int pipe)
break;
case 1:
for (j = 0; j < size; j++)
*buf++ = (u8) ((j % maxpacket) % 63);
*buf++ = (u8) (((j + n_size) % maxpacket) % 63);
n_size += size;
break;
}