summaryrefslogtreecommitdiff
path: root/drivers/usb/misc/usbtest.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/misc/usbtest.c')
-rw-r--r--drivers/usb/misc/usbtest.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index bae88893ee8e..150090ee4ec1 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -182,7 +182,7 @@ get_endpoints(struct usbtest_dev *dev, struct usb_interface *intf)
case USB_ENDPOINT_XFER_ISOC:
if (dev->info->iso)
endpoint_update(edi, &iso_in, &iso_out, e);
- /* FALLTHROUGH */
+ fallthrough;
default:
continue;
}
@@ -364,7 +364,7 @@ static void simple_fill_buf(struct urb *urb)
switch (pattern) {
default:
- /* FALLTHROUGH */
+ fallthrough;
case 0:
memset(buf, 0, len);
break;
@@ -681,7 +681,7 @@ static int get_altsetting(struct usbtest_dev *dev)
return dev->buf[0];
case 0:
retval = -ERANGE;
- /* FALLTHROUGH */
+ fallthrough;
default:
return retval;
}
@@ -1951,7 +1951,7 @@ static void complicated_callback(struct urb *urb)
dev_err(&ctx->dev->intf->dev,
"resubmit err %d\n",
status);
- /* FALLTHROUGH */
+ fallthrough;
case -ENODEV: /* disconnected */
case -ESHUTDOWN: /* endpoint disabled */
ctx->submit_error = 1;
@@ -2043,7 +2043,7 @@ test_queue(struct usbtest_dev *dev, struct usbtest_param_32 *param,
unsigned i;
unsigned long packets = 0;
int status = 0;
- struct urb *urbs[MAX_SGLEN];
+ struct urb **urbs;
if (!param->sglen || param->iterations > UINT_MAX / param->sglen)
return -EINVAL;
@@ -2051,6 +2051,10 @@ test_queue(struct usbtest_dev *dev, struct usbtest_param_32 *param,
if (param->sglen > MAX_SGLEN)
return -EINVAL;
+ urbs = kcalloc(param->sglen, sizeof(*urbs), GFP_KERNEL);
+ if (!urbs)
+ return -ENOMEM;
+
memset(&context, 0, sizeof(context));
context.count = param->iterations * param->sglen;
context.dev = dev;
@@ -2137,6 +2141,8 @@ test_queue(struct usbtest_dev *dev, struct usbtest_param_32 *param,
else if (context.errors >
(context.is_iso ? context.packet_count / 10 : 0))
status = -EIO;
+
+ kfree(urbs);
return status;
fail:
@@ -2144,6 +2150,8 @@ fail:
if (urbs[i])
simple_free_urb(urbs[i]);
}
+
+ kfree(urbs);
return status;
}