aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc
diff options
context:
space:
mode:
authorEric Sesterhenn <snakebyte@gmx.de>2006-02-27 15:29:43 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-20 17:49:59 -0500
commit80b6ca48321974a6566a1c9048ba34f60420bca6 (patch)
treea350e3cf6b794081c13c89d5b1913b2c1207570d /drivers/usb/misc
parentd54a5cb6484705f7808b337917cc7598f2f971c3 (diff)
[PATCH] USB: kzalloc() conversion for rest of drivers/usb
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/misc')
-rw-r--r--drivers/usb/misc/auerswald.c6
-rw-r--r--drivers/usb/misc/usblcd.c3
-rw-r--r--drivers/usb/misc/usbtest.c9
3 files changed, 6 insertions, 12 deletions
diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c
index ad2f4cccd388..1fef36e71c57 100644
--- a/drivers/usb/misc/auerswald.c
+++ b/drivers/usb/misc/auerswald.c
@@ -570,10 +570,9 @@ static int auerchain_setup (pauerchain_t acp, unsigned int numElements)
570 570
571 /* fill the list of free elements */ 571 /* fill the list of free elements */
572 for (;numElements; numElements--) { 572 for (;numElements; numElements--) {
573 acep = (pauerchainelement_t) kmalloc (sizeof (auerchainelement_t), GFP_KERNEL); 573 acep = kzalloc(sizeof(auerchainelement_t), GFP_KERNEL);
574 if (!acep) 574 if (!acep)
575 goto ac_fail; 575 goto ac_fail;
576 memset (acep, 0, sizeof (auerchainelement_t));
577 INIT_LIST_HEAD (&acep->list); 576 INIT_LIST_HEAD (&acep->list);
578 list_add_tail (&acep->list, &acp->free_list); 577 list_add_tail (&acep->list, &acp->free_list);
579 } 578 }
@@ -761,10 +760,9 @@ static int auerbuf_setup (pauerbufctl_t bcp, unsigned int numElements, unsigned
761 760
762 /* fill the list of free elements */ 761 /* fill the list of free elements */
763 for (;numElements; numElements--) { 762 for (;numElements; numElements--) {
764 bep = (pauerbuf_t) kmalloc (sizeof (auerbuf_t), GFP_KERNEL); 763 bep = kzalloc(sizeof(auerbuf_t), GFP_KERNEL);
765 if (!bep) 764 if (!bep)
766 goto bl_fail; 765 goto bl_fail;
767 memset (bep, 0, sizeof (auerbuf_t));
768 bep->list = bcp; 766 bep->list = bcp;
769 INIT_LIST_HEAD (&bep->buff_list); 767 INIT_LIST_HEAD (&bep->buff_list);
770 bep->bufp = kmalloc (bufsize, GFP_KERNEL); 768 bep->bufp = kmalloc (bufsize, GFP_KERNEL);
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c
index cc3dae3f34e0..c82c402285a0 100644
--- a/drivers/usb/misc/usblcd.c
+++ b/drivers/usb/misc/usblcd.c
@@ -270,12 +270,11 @@ static int lcd_probe(struct usb_interface *interface, const struct usb_device_id
270 int retval = -ENOMEM; 270 int retval = -ENOMEM;
271 271
272 /* allocate memory for our device state and initialize it */ 272 /* allocate memory for our device state and initialize it */
273 dev = kmalloc(sizeof(*dev), GFP_KERNEL); 273 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
274 if (dev == NULL) { 274 if (dev == NULL) {
275 err("Out of memory"); 275 err("Out of memory");
276 goto error; 276 goto error;
277 } 277 }
278 memset(dev, 0x00, sizeof(*dev));
279 kref_init(&dev->kref); 278 kref_init(&dev->kref);
280 279
281 dev->udev = usb_get_dev(interface_to_usbdev(interface)); 280 dev->udev = usb_get_dev(interface_to_usbdev(interface));
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);