diff options
Diffstat (limited to 'drivers/usb/misc/usbtest.c')
-rw-r--r-- | drivers/usb/misc/usbtest.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 84fa1728f052..9d59b901841c 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
@@ -382,12 +382,11 @@ alloc_sglist (int nents, int max, int vary) | |||
382 | for (i = 0; i < nents; i++) { | 382 | for (i = 0; i < nents; i++) { |
383 | char *buf; | 383 | char *buf; |
384 | 384 | ||
385 | buf = kmalloc (size, SLAB_KERNEL); | 385 | buf = kzalloc (size, SLAB_KERNEL); |
386 | if (!buf) { | 386 | if (!buf) { |
387 | free_sglist (sg, i); | 387 | free_sglist (sg, i); |
388 | return NULL; | 388 | return NULL; |
389 | } | 389 | } |
390 | memset (buf, 0, size); | ||
391 | 390 | ||
392 | /* kmalloc pages are always physically contiguous! */ | 391 | /* kmalloc pages are always physically contiguous! */ |
393 | sg_init_one(&sg[i], buf, size); | 392 | sg_init_one(&sg[i], buf, size); |
@@ -842,10 +841,9 @@ test_ctrl_queue (struct usbtest_dev *dev, struct usbtest_param *param) | |||
842 | * as with bulk/intr sglists, sglen is the queue depth; it also | 841 | * as with bulk/intr sglists, sglen is the queue depth; it also |
843 | * controls which subtests run (more tests than sglen) or rerun. | 842 | * controls which subtests run (more tests than sglen) or rerun. |
844 | */ | 843 | */ |
845 | urb = kmalloc (param->sglen * sizeof (struct urb *), SLAB_KERNEL); | 844 | urb = kcalloc(param->sglen, sizeof(struct urb *), SLAB_KERNEL); |
846 | if (!urb) | 845 | if (!urb) |
847 | return -ENOMEM; | 846 | return -ENOMEM; |
848 | memset (urb, 0, param->sglen * sizeof (struct urb *)); | ||
849 | for (i = 0; i < param->sglen; i++) { | 847 | for (i = 0; i < param->sglen; i++) { |
850 | int pipe = usb_rcvctrlpipe (udev, 0); | 848 | int pipe = usb_rcvctrlpipe (udev, 0); |
851 | unsigned len; | 849 | unsigned len; |
@@ -1865,10 +1863,9 @@ usbtest_probe (struct usb_interface *intf, const struct usb_device_id *id) | |||
1865 | } | 1863 | } |
1866 | #endif | 1864 | #endif |
1867 | 1865 | ||
1868 | dev = kmalloc (sizeof *dev, SLAB_KERNEL); | 1866 | dev = kzalloc(sizeof(*dev), SLAB_KERNEL); |
1869 | if (!dev) | 1867 | if (!dev) |
1870 | return -ENOMEM; | 1868 | return -ENOMEM; |
1871 | memset (dev, 0, sizeof *dev); | ||
1872 | info = (struct usbtest_info *) id->driver_info; | 1869 | info = (struct usbtest_info *) id->driver_info; |
1873 | dev->info = info; | 1870 | dev->info = info; |
1874 | init_MUTEX (&dev->sem); | 1871 | init_MUTEX (&dev->sem); |