Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a23ccd2 authored by Paul Zimmerman's avatar Paul Zimmerman Committed by Greg Kroah-Hartman
Browse files

usb: usbtest: two super speed fixes for usbtest



bMaxPacketSize0 field for super speed is a power of 2, not a count.
The size itself is always 512.

Max packet size for a super speed bulk endpoint is 1024, so
allocate the urb size in halt_simple() accordingly.

Signed-off-by: default avatarPaul Zimmerman <paulz@synopsys.com>
Acked-by: default avatarFelipe Balbi <balbi@ti.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 73108aa9
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -1028,6 +1028,9 @@ test_ctrl_queue(struct usbtest_dev *dev, struct usbtest_param *param)
		case 13:	/* short read, resembling case 10 */
			req.wValue = cpu_to_le16((USB_DT_CONFIG << 8) | 0);
			/* last data packet "should" be DATA1, not DATA0 */
			if (udev->speed == USB_SPEED_SUPER)
				len = 1024 - 512;
			else
				len = 1024 - udev->descriptor.bMaxPacketSize0;
			expected = -EREMOTEIO;
			break;
@@ -1390,8 +1393,12 @@ static int halt_simple(struct usbtest_dev *dev)
	int			ep;
	int			retval = 0;
	struct urb		*urb;
	struct usb_device	*udev = testdev_to_usbdev(dev);

	urb = simple_alloc_urb(testdev_to_usbdev(dev), 0, 512);
	if (udev->speed == USB_SPEED_SUPER)
		urb = simple_alloc_urb(udev, 0, 1024);
	else
		urb = simple_alloc_urb(udev, 0, 512);
	if (urb == NULL)
		return -ENOMEM;