diff options
Diffstat (limited to 'drivers/usb')
29 files changed, 48 insertions, 101 deletions
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c index ec7eb3f4f867..766061e0260a 100644 --- a/drivers/usb/host/ehci-mem.c +++ b/drivers/usb/host/ehci-mem.c | |||
@@ -220,13 +220,9 @@ static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags) | |||
220 | ehci->periodic [i] = EHCI_LIST_END; | 220 | ehci->periodic [i] = EHCI_LIST_END; |
221 | 221 | ||
222 | /* software shadow of hardware table */ | 222 | /* software shadow of hardware table */ |
223 | ehci->pshadow = kmalloc (ehci->periodic_size * sizeof (void *), flags); | 223 | ehci->pshadow = kcalloc(ehci->periodic_size, sizeof(void *), flags); |
224 | if (ehci->pshadow == NULL) { | 224 | if (ehci->pshadow != NULL) |
225 | goto fail; | 225 | return 0; |
226 | } | ||
227 | memset (ehci->pshadow, 0, ehci->periodic_size * sizeof (void *)); | ||
228 | |||
229 | return 0; | ||
230 | 226 | ||
231 | fail: | 227 | fail: |
232 | ehci_dbg (ehci, "couldn't init memory\n"); | 228 | ehci_dbg (ehci, "couldn't init memory\n"); |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index 90d6900a37f4..5871944e6145 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -864,9 +864,8 @@ iso_sched_alloc (unsigned packets, gfp_t mem_flags) | |||
864 | int size = sizeof *iso_sched; | 864 | int size = sizeof *iso_sched; |
865 | 865 | ||
866 | size += packets * sizeof (struct ehci_iso_packet); | 866 | size += packets * sizeof (struct ehci_iso_packet); |
867 | iso_sched = kmalloc (size, mem_flags); | 867 | iso_sched = kzalloc(size, mem_flags); |
868 | if (likely (iso_sched != NULL)) { | 868 | if (likely (iso_sched != NULL)) { |
869 | memset(iso_sched, 0, size); | ||
870 | INIT_LIST_HEAD (&iso_sched->td_list); | 869 | INIT_LIST_HEAD (&iso_sched->td_list); |
871 | } | 870 | } |
872 | return iso_sched; | 871 | return iso_sched; |
diff --git a/drivers/usb/host/hc_crisv10.c b/drivers/usb/host/hc_crisv10.c index 641268d7e6f3..2fe7fd19437b 100644 --- a/drivers/usb/host/hc_crisv10.c +++ b/drivers/usb/host/hc_crisv10.c | |||
@@ -2137,10 +2137,9 @@ static int etrax_usb_submit_bulk_urb(struct urb *urb) | |||
2137 | urb->status = -EINPROGRESS; | 2137 | urb->status = -EINPROGRESS; |
2138 | 2138 | ||
2139 | /* Setup the hcpriv data. */ | 2139 | /* Setup the hcpriv data. */ |
2140 | urb_priv = kmalloc(sizeof(etrax_urb_priv_t), KMALLOC_FLAG); | 2140 | urb_priv = kzalloc(sizeof(etrax_urb_priv_t), KMALLOC_FLAG); |
2141 | assert(urb_priv != NULL); | 2141 | assert(urb_priv != NULL); |
2142 | /* This sets rx_offset to 0. */ | 2142 | /* This sets rx_offset to 0. */ |
2143 | memset(urb_priv, 0, sizeof(etrax_urb_priv_t)); | ||
2144 | urb_priv->urb_state = NOT_STARTED; | 2143 | urb_priv->urb_state = NOT_STARTED; |
2145 | urb->hcpriv = urb_priv; | 2144 | urb->hcpriv = urb_priv; |
2146 | 2145 | ||
@@ -2475,10 +2474,9 @@ static int etrax_usb_submit_ctrl_urb(struct urb *urb) | |||
2475 | urb->status = -EINPROGRESS; | 2474 | urb->status = -EINPROGRESS; |
2476 | 2475 | ||
2477 | /* Setup the hcpriv data. */ | 2476 | /* Setup the hcpriv data. */ |
2478 | urb_priv = kmalloc(sizeof(etrax_urb_priv_t), KMALLOC_FLAG); | 2477 | urb_priv = kzalloc(sizeof(etrax_urb_priv_t), KMALLOC_FLAG); |
2479 | assert(urb_priv != NULL); | 2478 | assert(urb_priv != NULL); |
2480 | /* This sets rx_offset to 0. */ | 2479 | /* This sets rx_offset to 0. */ |
2481 | memset(urb_priv, 0, sizeof(etrax_urb_priv_t)); | ||
2482 | urb_priv->urb_state = NOT_STARTED; | 2480 | urb_priv->urb_state = NOT_STARTED; |
2483 | urb->hcpriv = urb_priv; | 2481 | urb->hcpriv = urb_priv; |
2484 | 2482 | ||
@@ -2767,9 +2765,8 @@ static void etrax_usb_add_to_intr_sb_list(struct urb *urb, int epid) | |||
2767 | maxlen = usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe)); | 2765 | maxlen = usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe)); |
2768 | interval = urb->interval; | 2766 | interval = urb->interval; |
2769 | 2767 | ||
2770 | urb_priv = kmalloc(sizeof(etrax_urb_priv_t), KMALLOC_FLAG); | 2768 | urb_priv = kzalloc(sizeof(etrax_urb_priv_t), KMALLOC_FLAG); |
2771 | assert(urb_priv != NULL); | 2769 | assert(urb_priv != NULL); |
2772 | memset(urb_priv, 0, sizeof(etrax_urb_priv_t)); | ||
2773 | urb->hcpriv = urb_priv; | 2770 | urb->hcpriv = urb_priv; |
2774 | 2771 | ||
2775 | first_ep = &TxIntrEPList[0]; | 2772 | first_ep = &TxIntrEPList[0]; |
@@ -2997,9 +2994,8 @@ static void etrax_usb_add_to_isoc_sb_list(struct urb *urb, int epid) | |||
2997 | 2994 | ||
2998 | prev_sb_desc = next_sb_desc = temp_sb_desc = NULL; | 2995 | prev_sb_desc = next_sb_desc = temp_sb_desc = NULL; |
2999 | 2996 | ||
3000 | urb_priv = kmalloc(sizeof(etrax_urb_priv_t), GFP_ATOMIC); | 2997 | urb_priv = kzalloc(sizeof(etrax_urb_priv_t), GFP_ATOMIC); |
3001 | assert(urb_priv != NULL); | 2998 | assert(urb_priv != NULL); |
3002 | memset(urb_priv, 0, sizeof(etrax_urb_priv_t)); | ||
3003 | 2999 | ||
3004 | urb->hcpriv = urb_priv; | 3000 | urb->hcpriv = urb_priv; |
3005 | urb_priv->epid = epid; | 3001 | urb_priv->epid = epid; |
diff --git a/drivers/usb/media/ov511.c b/drivers/usb/media/ov511.c index 1d887ec06080..da44579d6f29 100644 --- a/drivers/usb/media/ov511.c +++ b/drivers/usb/media/ov511.c | |||
@@ -5686,13 +5686,11 @@ ov51x_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
5686 | if (idesc->bInterfaceSubClass != 0x00) | 5686 | if (idesc->bInterfaceSubClass != 0x00) |
5687 | return -ENODEV; | 5687 | return -ENODEV; |
5688 | 5688 | ||
5689 | if ((ov = kmalloc(sizeof(*ov), GFP_KERNEL)) == NULL) { | 5689 | if ((ov = kzalloc(sizeof(*ov), GFP_KERNEL)) == NULL) { |
5690 | err("couldn't kmalloc ov struct"); | 5690 | err("couldn't kmalloc ov struct"); |
5691 | goto error_out; | 5691 | goto error_out; |
5692 | } | 5692 | } |
5693 | 5693 | ||
5694 | memset(ov, 0, sizeof(*ov)); | ||
5695 | |||
5696 | ov->dev = dev; | 5694 | ov->dev = dev; |
5697 | ov->iface = idesc->bInterfaceNumber; | 5695 | ov->iface = idesc->bInterfaceNumber; |
5698 | ov->led_policy = led; | 5696 | ov->led_policy = led; |
diff --git a/drivers/usb/media/pwc/pwc-if.c b/drivers/usb/media/pwc/pwc-if.c index db6753dc5ba5..90eb26042817 100644 --- a/drivers/usb/media/pwc/pwc-if.c +++ b/drivers/usb/media/pwc/pwc-if.c | |||
@@ -1867,12 +1867,11 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1867 | Info("Warning: more than 1 configuration available.\n"); | 1867 | Info("Warning: more than 1 configuration available.\n"); |
1868 | 1868 | ||
1869 | /* Allocate structure, initialize pointers, mutexes, etc. and link it to the usb_device */ | 1869 | /* Allocate structure, initialize pointers, mutexes, etc. and link it to the usb_device */ |
1870 | pdev = kmalloc(sizeof(struct pwc_device), GFP_KERNEL); | 1870 | pdev = kzalloc(sizeof(struct pwc_device), GFP_KERNEL); |
1871 | if (pdev == NULL) { | 1871 | if (pdev == NULL) { |
1872 | Err("Oops, could not allocate memory for pwc_device.\n"); | 1872 | Err("Oops, could not allocate memory for pwc_device.\n"); |
1873 | return -ENOMEM; | 1873 | return -ENOMEM; |
1874 | } | 1874 | } |
1875 | memset(pdev, 0, sizeof(struct pwc_device)); | ||
1876 | pdev->type = type_id; | 1875 | pdev->type = type_id; |
1877 | pdev->vsize = default_size; | 1876 | pdev->vsize = default_size; |
1878 | pdev->vframes = default_fps; | 1877 | pdev->vframes = default_fps; |
diff --git a/drivers/usb/media/se401.c b/drivers/usb/media/se401.c index 8c3b1ad8a8fd..f03ea7f89596 100644 --- a/drivers/usb/media/se401.c +++ b/drivers/usb/media/se401.c | |||
@@ -1345,13 +1345,11 @@ static int se401_probe(struct usb_interface *intf, | |||
1345 | /* We found one */ | 1345 | /* We found one */ |
1346 | info("SE401 camera found: %s", camera_name); | 1346 | info("SE401 camera found: %s", camera_name); |
1347 | 1347 | ||
1348 | if ((se401 = kmalloc(sizeof(*se401), GFP_KERNEL)) == NULL) { | 1348 | if ((se401 = kzalloc(sizeof(*se401), GFP_KERNEL)) == NULL) { |
1349 | err("couldn't kmalloc se401 struct"); | 1349 | err("couldn't kmalloc se401 struct"); |
1350 | return -ENOMEM; | 1350 | return -ENOMEM; |
1351 | } | 1351 | } |
1352 | 1352 | ||
1353 | memset(se401, 0, sizeof(*se401)); | ||
1354 | |||
1355 | se401->dev = dev; | 1353 | se401->dev = dev; |
1356 | se401->iface = interface->bInterfaceNumber; | 1354 | se401->iface = interface->bInterfaceNumber; |
1357 | se401->camera_name = camera_name; | 1355 | se401->camera_name = camera_name; |
diff --git a/drivers/usb/media/stv680.c b/drivers/usb/media/stv680.c index b1a6be2958ed..9636da20748d 100644 --- a/drivers/usb/media/stv680.c +++ b/drivers/usb/media/stv680.c | |||
@@ -318,12 +318,11 @@ static int stv_init (struct usb_stv *stv680) | |||
318 | unsigned char *buffer; | 318 | unsigned char *buffer; |
319 | unsigned long int bufsize; | 319 | unsigned long int bufsize; |
320 | 320 | ||
321 | buffer = kmalloc (40, GFP_KERNEL); | 321 | buffer = kzalloc (40, GFP_KERNEL); |
322 | if (buffer == NULL) { | 322 | if (buffer == NULL) { |
323 | PDEBUG (0, "STV(e): Out of (small buf) memory"); | 323 | PDEBUG (0, "STV(e): Out of (small buf) memory"); |
324 | return -1; | 324 | return -1; |
325 | } | 325 | } |
326 | memset (buffer, 0, 40); | ||
327 | udelay (100); | 326 | udelay (100); |
328 | 327 | ||
329 | /* set config 1, interface 0, alternate 0 */ | 328 | /* set config 1, interface 0, alternate 0 */ |
@@ -1388,14 +1387,12 @@ static int stv680_probe (struct usb_interface *intf, const struct usb_device_id | |||
1388 | goto error; | 1387 | goto error; |
1389 | } | 1388 | } |
1390 | /* We found one */ | 1389 | /* We found one */ |
1391 | if ((stv680 = kmalloc (sizeof (*stv680), GFP_KERNEL)) == NULL) { | 1390 | if ((stv680 = kzalloc (sizeof (*stv680), GFP_KERNEL)) == NULL) { |
1392 | PDEBUG (0, "STV(e): couldn't kmalloc stv680 struct."); | 1391 | PDEBUG (0, "STV(e): couldn't kmalloc stv680 struct."); |
1393 | retval = -ENOMEM; | 1392 | retval = -ENOMEM; |
1394 | goto error; | 1393 | goto error; |
1395 | } | 1394 | } |
1396 | 1395 | ||
1397 | memset (stv680, 0, sizeof (*stv680)); | ||
1398 | |||
1399 | stv680->udev = dev; | 1396 | stv680->udev = dev; |
1400 | stv680->camera_name = camera_name; | 1397 | stv680->camera_name = camera_name; |
1401 | 1398 | ||
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); |
diff --git a/drivers/usb/mon/mon_main.c b/drivers/usb/mon/mon_main.c index b03e346e33f1..6ecc27302211 100644 --- a/drivers/usb/mon/mon_main.c +++ b/drivers/usb/mon/mon_main.c | |||
@@ -277,9 +277,8 @@ static void mon_bus_init(struct dentry *mondir, struct usb_bus *ubus) | |||
277 | char name[NAMESZ]; | 277 | char name[NAMESZ]; |
278 | int rc; | 278 | int rc; |
279 | 279 | ||
280 | if ((mbus = kmalloc(sizeof(struct mon_bus), GFP_KERNEL)) == NULL) | 280 | if ((mbus = kzalloc(sizeof(struct mon_bus), GFP_KERNEL)) == NULL) |
281 | goto err_alloc; | 281 | goto err_alloc; |
282 | memset(mbus, 0, sizeof(struct mon_bus)); | ||
283 | kref_init(&mbus->ref); | 282 | kref_init(&mbus->ref); |
284 | spin_lock_init(&mbus->lock); | 283 | spin_lock_init(&mbus->lock); |
285 | INIT_LIST_HEAD(&mbus->r_list); | 284 | INIT_LIST_HEAD(&mbus->r_list); |
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c index 59089e8b7e5e..ac043ec2b8dc 100644 --- a/drivers/usb/mon/mon_text.c +++ b/drivers/usb/mon/mon_text.c | |||
@@ -213,12 +213,11 @@ static int mon_text_open(struct inode *inode, struct file *file) | |||
213 | mbus = inode->u.generic_ip; | 213 | mbus = inode->u.generic_ip; |
214 | ubus = mbus->u_bus; | 214 | ubus = mbus->u_bus; |
215 | 215 | ||
216 | rp = kmalloc(sizeof(struct mon_reader_text), GFP_KERNEL); | 216 | rp = kzalloc(sizeof(struct mon_reader_text), GFP_KERNEL); |
217 | if (rp == NULL) { | 217 | if (rp == NULL) { |
218 | rc = -ENOMEM; | 218 | rc = -ENOMEM; |
219 | goto err_alloc; | 219 | goto err_alloc; |
220 | } | 220 | } |
221 | memset(rp, 0, sizeof(struct mon_reader_text)); | ||
222 | INIT_LIST_HEAD(&rp->e_list); | 221 | INIT_LIST_HEAD(&rp->e_list); |
223 | init_waitqueue_head(&rp->wait); | 222 | init_waitqueue_head(&rp->wait); |
224 | mutex_init(&rp->printf_lock); | 223 | mutex_init(&rp->printf_lock); |
diff --git a/drivers/usb/net/zd1201.c b/drivers/usb/net/zd1201.c index f3a8e2807c3b..fe9b60cd8d95 100644 --- a/drivers/usb/net/zd1201.c +++ b/drivers/usb/net/zd1201.c | |||
@@ -621,10 +621,9 @@ static int zd1201_drvr_start(struct zd1201 *zd) | |||
621 | __le16 zdmax; | 621 | __le16 zdmax; |
622 | unsigned char *buffer; | 622 | unsigned char *buffer; |
623 | 623 | ||
624 | buffer = kmalloc(ZD1201_RXSIZE, GFP_KERNEL); | 624 | buffer = kzalloc(ZD1201_RXSIZE, GFP_KERNEL); |
625 | if (!buffer) | 625 | if (!buffer) |
626 | return -ENOMEM; | 626 | return -ENOMEM; |
627 | memset(buffer, 0, ZD1201_RXSIZE); | ||
628 | 627 | ||
629 | usb_fill_bulk_urb(zd->rx_urb, zd->usb, | 628 | usb_fill_bulk_urb(zd->rx_urb, zd->usb, |
630 | usb_rcvbulkpipe(zd->usb, zd->endp_in), buffer, ZD1201_RXSIZE, | 629 | usb_rcvbulkpipe(zd->usb, zd->endp_in), buffer, ZD1201_RXSIZE, |
@@ -1750,11 +1749,9 @@ static int zd1201_probe(struct usb_interface *interface, | |||
1750 | 1749 | ||
1751 | usb = interface_to_usbdev(interface); | 1750 | usb = interface_to_usbdev(interface); |
1752 | 1751 | ||
1753 | zd = kmalloc(sizeof(struct zd1201), GFP_KERNEL); | 1752 | zd = kzalloc(sizeof(struct zd1201), GFP_KERNEL); |
1754 | if (!zd) { | 1753 | if (!zd) |
1755 | return -ENOMEM; | 1754 | return -ENOMEM; |
1756 | } | ||
1757 | memset(zd, 0, sizeof(struct zd1201)); | ||
1758 | zd->ap = ap; | 1755 | zd->ap = ap; |
1759 | zd->usb = usb; | 1756 | zd->usb = usb; |
1760 | zd->removed = 0; | 1757 | zd->removed = 0; |
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c index dc7a069503e0..9ea7b4a4a22b 100644 --- a/drivers/usb/serial/cp2101.c +++ b/drivers/usb/serial/cp2101.c | |||
@@ -169,9 +169,7 @@ static int cp2101_get_config(struct usb_serial_port* port, u8 request, | |||
169 | /* Number of integers required to contain the array */ | 169 | /* Number of integers required to contain the array */ |
170 | length = (((size - 1) | 3) + 1)/4; | 170 | length = (((size - 1) | 3) + 1)/4; |
171 | 171 | ||
172 | buf = kmalloc (length * sizeof(u32), GFP_KERNEL); | 172 | buf = kcalloc(length, sizeof(u32), GFP_KERNEL); |
173 | memset(buf, 0, length * sizeof(u32)); | ||
174 | |||
175 | if (!buf) { | 173 | if (!buf) { |
176 | dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__); | 174 | dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__); |
177 | return -ENOMEM; | 175 | return -ENOMEM; |
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 68067fe117a4..71af3bf5adb7 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -435,11 +435,10 @@ static int generic_startup (struct usb_serial *serial) | |||
435 | 435 | ||
436 | dbg("%s - port %d", __FUNCTION__, serial->port[0]->number); | 436 | dbg("%s - port %d", __FUNCTION__, serial->port[0]->number); |
437 | 437 | ||
438 | priv = kmalloc(sizeof (struct cypress_private), GFP_KERNEL); | 438 | priv = kzalloc(sizeof (struct cypress_private), GFP_KERNEL); |
439 | if (!priv) | 439 | if (!priv) |
440 | return -ENOMEM; | 440 | return -ENOMEM; |
441 | 441 | ||
442 | memset(priv, 0x00, sizeof (struct cypress_private)); | ||
443 | spin_lock_init(&priv->lock); | 442 | spin_lock_init(&priv->lock); |
444 | priv->buf = cypress_buf_alloc(CYPRESS_BUF_SIZE); | 443 | priv->buf = cypress_buf_alloc(CYPRESS_BUF_SIZE); |
445 | if (priv->buf == NULL) { | 444 | if (priv->buf == NULL) { |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index c145e1ed8429..ece52a6328b5 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -1141,12 +1141,11 @@ static int ftdi_sio_attach (struct usb_serial *serial) | |||
1141 | 1141 | ||
1142 | dbg("%s",__FUNCTION__); | 1142 | dbg("%s",__FUNCTION__); |
1143 | 1143 | ||
1144 | priv = kmalloc(sizeof(struct ftdi_private), GFP_KERNEL); | 1144 | priv = kzalloc(sizeof(struct ftdi_private), GFP_KERNEL); |
1145 | if (!priv){ | 1145 | if (!priv){ |
1146 | err("%s- kmalloc(%Zd) failed.", __FUNCTION__, sizeof(struct ftdi_private)); | 1146 | err("%s- kmalloc(%Zd) failed.", __FUNCTION__, sizeof(struct ftdi_private)); |
1147 | return -ENOMEM; | 1147 | return -ENOMEM; |
1148 | } | 1148 | } |
1149 | memset(priv, 0, sizeof(*priv)); | ||
1150 | 1149 | ||
1151 | spin_lock_init(&priv->rx_lock); | 1150 | spin_lock_init(&priv->rx_lock); |
1152 | init_waitqueue_head(&priv->delta_msr_wait); | 1151 | init_waitqueue_head(&priv->delta_msr_wait); |
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index d6f55e9dccae..5ec9bf5bac8d 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c | |||
@@ -1422,12 +1422,11 @@ static int garmin_attach (struct usb_serial *serial) | |||
1422 | 1422 | ||
1423 | dbg("%s", __FUNCTION__); | 1423 | dbg("%s", __FUNCTION__); |
1424 | 1424 | ||
1425 | garmin_data_p = kmalloc (sizeof(struct garmin_data), GFP_KERNEL); | 1425 | garmin_data_p = kzalloc(sizeof(struct garmin_data), GFP_KERNEL); |
1426 | if (garmin_data_p == NULL) { | 1426 | if (garmin_data_p == NULL) { |
1427 | dev_err(&port->dev, "%s - Out of memory\n", __FUNCTION__); | 1427 | dev_err(&port->dev, "%s - Out of memory\n", __FUNCTION__); |
1428 | return -ENOMEM; | 1428 | return -ENOMEM; |
1429 | } | 1429 | } |
1430 | memset (garmin_data_p, 0, sizeof(struct garmin_data)); | ||
1431 | init_timer(&garmin_data_p->timer); | 1430 | init_timer(&garmin_data_p->timer); |
1432 | spin_lock_init(&garmin_data_p->lock); | 1431 | spin_lock_init(&garmin_data_p->lock); |
1433 | INIT_LIST_HEAD(&garmin_data_p->pktlist); | 1432 | INIT_LIST_HEAD(&garmin_data_p->pktlist); |
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 3f29e6b0fd19..b606c5968102 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -2725,12 +2725,11 @@ static int edge_startup (struct usb_serial *serial) | |||
2725 | dev = serial->dev; | 2725 | dev = serial->dev; |
2726 | 2726 | ||
2727 | /* create our private serial structure */ | 2727 | /* create our private serial structure */ |
2728 | edge_serial = kmalloc (sizeof(struct edgeport_serial), GFP_KERNEL); | 2728 | edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); |
2729 | if (edge_serial == NULL) { | 2729 | if (edge_serial == NULL) { |
2730 | dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__); | 2730 | dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__); |
2731 | return -ENOMEM; | 2731 | return -ENOMEM; |
2732 | } | 2732 | } |
2733 | memset (edge_serial, 0, sizeof(struct edgeport_serial)); | ||
2734 | spin_lock_init(&edge_serial->es_lock); | 2733 | spin_lock_init(&edge_serial->es_lock); |
2735 | edge_serial->serial = serial; | 2734 | edge_serial->serial = serial; |
2736 | usb_set_serial_data(serial, edge_serial); | 2735 | usb_set_serial_data(serial, edge_serial); |
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index afc0f34b3a46..8e1e2253748b 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -2727,12 +2727,11 @@ static int edge_startup (struct usb_serial *serial) | |||
2727 | dev = serial->dev; | 2727 | dev = serial->dev; |
2728 | 2728 | ||
2729 | /* create our private serial structure */ | 2729 | /* create our private serial structure */ |
2730 | edge_serial = kmalloc (sizeof(struct edgeport_serial), GFP_KERNEL); | 2730 | edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); |
2731 | if (edge_serial == NULL) { | 2731 | if (edge_serial == NULL) { |
2732 | dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__); | 2732 | dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__); |
2733 | return -ENOMEM; | 2733 | return -ENOMEM; |
2734 | } | 2734 | } |
2735 | memset (edge_serial, 0, sizeof(struct edgeport_serial)); | ||
2736 | sema_init(&edge_serial->es_sem, 1); | 2735 | sema_init(&edge_serial->es_sem, 1); |
2737 | edge_serial->serial = serial; | 2736 | edge_serial->serial = serial; |
2738 | usb_set_serial_data(serial, edge_serial); | 2737 | usb_set_serial_data(serial, edge_serial); |
@@ -2745,12 +2744,11 @@ static int edge_startup (struct usb_serial *serial) | |||
2745 | 2744 | ||
2746 | /* set up our port private structures */ | 2745 | /* set up our port private structures */ |
2747 | for (i = 0; i < serial->num_ports; ++i) { | 2746 | for (i = 0; i < serial->num_ports; ++i) { |
2748 | edge_port = kmalloc (sizeof(struct edgeport_port), GFP_KERNEL); | 2747 | edge_port = kzalloc(sizeof(struct edgeport_port), GFP_KERNEL); |
2749 | if (edge_port == NULL) { | 2748 | if (edge_port == NULL) { |
2750 | dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__); | 2749 | dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__); |
2751 | goto cleanup; | 2750 | goto cleanup; |
2752 | } | 2751 | } |
2753 | memset (edge_port, 0, sizeof(struct edgeport_port)); | ||
2754 | spin_lock_init(&edge_port->ep_lock); | 2752 | spin_lock_init(&edge_port->ep_lock); |
2755 | edge_port->ep_out_buf = edge_buf_alloc(EDGE_OUT_BUF_SIZE); | 2753 | edge_port->ep_out_buf = edge_buf_alloc(EDGE_OUT_BUF_SIZE); |
2756 | if (edge_port->ep_out_buf == NULL) { | 2754 | if (edge_port->ep_out_buf == NULL) { |
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c index a59010421444..426182ddc42a 100644 --- a/drivers/usb/serial/ir-usb.c +++ b/drivers/usb/serial/ir-usb.c | |||
@@ -184,10 +184,9 @@ static struct irda_class_desc *irda_usb_find_class_desc(struct usb_device *dev, | |||
184 | struct irda_class_desc *desc; | 184 | struct irda_class_desc *desc; |
185 | int ret; | 185 | int ret; |
186 | 186 | ||
187 | desc = kmalloc(sizeof (struct irda_class_desc), GFP_KERNEL); | 187 | desc = kzalloc(sizeof (struct irda_class_desc), GFP_KERNEL); |
188 | if (desc == NULL) | 188 | if (desc == NULL) |
189 | return NULL; | 189 | return NULL; |
190 | memset(desc, 0, sizeof(struct irda_class_desc)); | ||
191 | 190 | ||
192 | ret = usb_control_msg(dev, usb_rcvctrlpipe(dev,0), | 191 | ret = usb_control_msg(dev, usb_rcvctrlpipe(dev,0), |
193 | IU_REQ_GET_CLASS_DESC, | 192 | IU_REQ_GET_CLASS_DESC, |
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 3b958e60f5e8..052b735c4fbd 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -2250,12 +2250,11 @@ static int keyspan_startup (struct usb_serial *serial) | |||
2250 | } | 2250 | } |
2251 | 2251 | ||
2252 | /* Setup private data for serial driver */ | 2252 | /* Setup private data for serial driver */ |
2253 | s_priv = kmalloc(sizeof(struct keyspan_serial_private), GFP_KERNEL); | 2253 | s_priv = kzalloc(sizeof(struct keyspan_serial_private), GFP_KERNEL); |
2254 | if (!s_priv) { | 2254 | if (!s_priv) { |
2255 | dbg("%s - kmalloc for keyspan_serial_private failed.", __FUNCTION__); | 2255 | dbg("%s - kmalloc for keyspan_serial_private failed.", __FUNCTION__); |
2256 | return -ENOMEM; | 2256 | return -ENOMEM; |
2257 | } | 2257 | } |
2258 | memset(s_priv, 0, sizeof(struct keyspan_serial_private)); | ||
2259 | 2258 | ||
2260 | s_priv->device_details = d_details; | 2259 | s_priv->device_details = d_details; |
2261 | usb_set_serial_data(serial, s_priv); | 2260 | usb_set_serial_data(serial, s_priv); |
@@ -2263,12 +2262,11 @@ static int keyspan_startup (struct usb_serial *serial) | |||
2263 | /* Now setup per port private data */ | 2262 | /* Now setup per port private data */ |
2264 | for (i = 0; i < serial->num_ports; i++) { | 2263 | for (i = 0; i < serial->num_ports; i++) { |
2265 | port = serial->port[i]; | 2264 | port = serial->port[i]; |
2266 | p_priv = kmalloc(sizeof(struct keyspan_port_private), GFP_KERNEL); | 2265 | p_priv = kzalloc(sizeof(struct keyspan_port_private), GFP_KERNEL); |
2267 | if (!p_priv) { | 2266 | if (!p_priv) { |
2268 | dbg("%s - kmalloc for keyspan_port_private (%d) failed!.", __FUNCTION__, i); | 2267 | dbg("%s - kmalloc for keyspan_port_private (%d) failed!.", __FUNCTION__, i); |
2269 | return (1); | 2268 | return (1); |
2270 | } | 2269 | } |
2271 | memset(p_priv, 0, sizeof(struct keyspan_port_private)); | ||
2272 | p_priv->device_details = d_details; | 2270 | p_priv->device_details = d_details; |
2273 | usb_set_serial_port_data(port, p_priv); | 2271 | usb_set_serial_port_data(port, p_priv); |
2274 | } | 2272 | } |
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index b8b213185d0f..87dfcd89ffab 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c | |||
@@ -255,11 +255,9 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp) | |||
255 | } | 255 | } |
256 | 256 | ||
257 | // allocate memory for transfer buffer | 257 | // allocate memory for transfer buffer |
258 | transfer_buffer = (unsigned char *) kmalloc(transfer_buffer_length, GFP_KERNEL); | 258 | transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL); |
259 | if (! transfer_buffer) { | 259 | if (! transfer_buffer) { |
260 | return -ENOMEM; | 260 | return -ENOMEM; |
261 | } else { | ||
262 | memset(transfer_buffer, 0, transfer_buffer_length); | ||
263 | } | 261 | } |
264 | 262 | ||
265 | // allocate write_urb | 263 | // allocate write_urb |
@@ -383,11 +381,10 @@ static void kobil_read_int_callback( struct urb *purb, struct pt_regs *regs) | |||
383 | 381 | ||
384 | // BEGIN DEBUG | 382 | // BEGIN DEBUG |
385 | /* | 383 | /* |
386 | dbg_data = (unsigned char *) kmalloc((3 * purb->actual_length + 10) * sizeof(char), GFP_KERNEL); | 384 | dbg_data = kzalloc((3 * purb->actual_length + 10) * sizeof(char), GFP_KERNEL); |
387 | if (! dbg_data) { | 385 | if (! dbg_data) { |
388 | return; | 386 | return; |
389 | } | 387 | } |
390 | memset(dbg_data, 0, (3 * purb->actual_length + 10)); | ||
391 | for (i = 0; i < purb->actual_length; i++) { | 388 | for (i = 0; i < purb->actual_length; i++) { |
392 | sprintf(dbg_data +3*i, "%02X ", data[i]); | 389 | sprintf(dbg_data +3*i, "%02X ", data[i]); |
393 | } | 390 | } |
@@ -518,11 +515,10 @@ static int kobil_tiocmget(struct usb_serial_port *port, struct file *file) | |||
518 | } | 515 | } |
519 | 516 | ||
520 | // allocate memory for transfer buffer | 517 | // allocate memory for transfer buffer |
521 | transfer_buffer = (unsigned char *) kmalloc(transfer_buffer_length, GFP_KERNEL); | 518 | transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL); |
522 | if (!transfer_buffer) { | 519 | if (!transfer_buffer) { |
523 | return -ENOMEM; | 520 | return -ENOMEM; |
524 | } | 521 | } |
525 | memset(transfer_buffer, 0, transfer_buffer_length); | ||
526 | 522 | ||
527 | result = usb_control_msg( port->serial->dev, | 523 | result = usb_control_msg( port->serial->dev, |
528 | usb_rcvctrlpipe(port->serial->dev, 0 ), | 524 | usb_rcvctrlpipe(port->serial->dev, 0 ), |
@@ -564,11 +560,10 @@ static int kobil_tiocmset(struct usb_serial_port *port, struct file *file, | |||
564 | } | 560 | } |
565 | 561 | ||
566 | // allocate memory for transfer buffer | 562 | // allocate memory for transfer buffer |
567 | transfer_buffer = (unsigned char *) kmalloc(transfer_buffer_length, GFP_KERNEL); | 563 | transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL); |
568 | if (! transfer_buffer) { | 564 | if (! transfer_buffer) { |
569 | return -ENOMEM; | 565 | return -ENOMEM; |
570 | } | 566 | } |
571 | memset(transfer_buffer, 0, transfer_buffer_length); | ||
572 | 567 | ||
573 | if (set & TIOCM_RTS) | 568 | if (set & TIOCM_RTS) |
574 | rts = 1; | 569 | rts = 1; |
@@ -655,11 +650,10 @@ static int kobil_ioctl(struct usb_serial_port *port, struct file *file, | |||
655 | (struct termios __user *)arg)) | 650 | (struct termios __user *)arg)) |
656 | return -EFAULT; | 651 | return -EFAULT; |
657 | 652 | ||
658 | settings = (unsigned char *) kmalloc(50, GFP_KERNEL); | 653 | settings = kzalloc(50, GFP_KERNEL); |
659 | if (! settings) { | 654 | if (! settings) { |
660 | return -ENOBUFS; | 655 | return -ENOBUFS; |
661 | } | 656 | } |
662 | memset(settings, 0, 50); | ||
663 | 657 | ||
664 | switch (priv->internal_termios.c_cflag & CBAUD) { | 658 | switch (priv->internal_termios.c_cflag & CBAUD) { |
665 | case B1200: | 659 | case B1200: |
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index b6d6cab9c859..35bd29b6c408 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c | |||
@@ -348,10 +348,9 @@ static int mct_u232_startup (struct usb_serial *serial) | |||
348 | struct mct_u232_private *priv; | 348 | struct mct_u232_private *priv; |
349 | struct usb_serial_port *port, *rport; | 349 | struct usb_serial_port *port, *rport; |
350 | 350 | ||
351 | priv = kmalloc(sizeof(struct mct_u232_private), GFP_KERNEL); | 351 | priv = kzalloc(sizeof(struct mct_u232_private), GFP_KERNEL); |
352 | if (!priv) | 352 | if (!priv) |
353 | return -ENOMEM; | 353 | return -ENOMEM; |
354 | memset(priv, 0, sizeof(struct mct_u232_private)); | ||
355 | spin_lock_init(&priv->lock); | 354 | spin_lock_init(&priv->lock); |
356 | usb_set_serial_port_data(serial->port[0], priv); | 355 | usb_set_serial_port_data(serial->port[0], priv); |
357 | 356 | ||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 52bdf6fe46f2..a8455c9e79dd 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -631,13 +631,12 @@ static int option_startup(struct usb_serial *serial) | |||
631 | /* Now setup per port private data */ | 631 | /* Now setup per port private data */ |
632 | for (i = 0; i < serial->num_ports; i++) { | 632 | for (i = 0; i < serial->num_ports; i++) { |
633 | port = serial->port[i]; | 633 | port = serial->port[i]; |
634 | portdata = kmalloc(sizeof(*portdata), GFP_KERNEL); | 634 | portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); |
635 | if (!portdata) { | 635 | if (!portdata) { |
636 | dbg("%s: kmalloc for option_port_private (%d) failed!.", | 636 | dbg("%s: kmalloc for option_port_private (%d) failed!.", |
637 | __FUNCTION__, i); | 637 | __FUNCTION__, i); |
638 | return (1); | 638 | return (1); |
639 | } | 639 | } |
640 | memset(portdata, 0, sizeof(struct option_port_private)); | ||
641 | 640 | ||
642 | usb_set_serial_port_data(port, portdata); | 641 | usb_set_serial_port_data(port, portdata); |
643 | 642 | ||
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 37c81c08faad..cf2213bae0e0 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -218,10 +218,9 @@ static int pl2303_startup (struct usb_serial *serial) | |||
218 | dbg("device type: %d", type); | 218 | dbg("device type: %d", type); |
219 | 219 | ||
220 | for (i = 0; i < serial->num_ports; ++i) { | 220 | for (i = 0; i < serial->num_ports; ++i) { |
221 | priv = kmalloc (sizeof (struct pl2303_private), GFP_KERNEL); | 221 | priv = kzalloc(sizeof(struct pl2303_private), GFP_KERNEL); |
222 | if (!priv) | 222 | if (!priv) |
223 | goto cleanup; | 223 | goto cleanup; |
224 | memset (priv, 0x00, sizeof (struct pl2303_private)); | ||
225 | spin_lock_init(&priv->lock); | 224 | spin_lock_init(&priv->lock); |
226 | priv->buf = pl2303_buf_alloc(PL2303_BUF_SIZE); | 225 | priv->buf = pl2303_buf_alloc(PL2303_BUF_SIZE); |
227 | if (priv->buf == NULL) { | 226 | if (priv->buf == NULL) { |
@@ -383,12 +382,11 @@ static void pl2303_set_termios (struct usb_serial_port *port, struct termios *ol | |||
383 | } | 382 | } |
384 | } | 383 | } |
385 | 384 | ||
386 | buf = kmalloc (7, GFP_KERNEL); | 385 | buf = kzalloc (7, GFP_KERNEL); |
387 | if (!buf) { | 386 | if (!buf) { |
388 | dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__); | 387 | dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__); |
389 | return; | 388 | return; |
390 | } | 389 | } |
391 | memset (buf, 0x00, 0x07); | ||
392 | 390 | ||
393 | i = usb_control_msg (serial->dev, usb_rcvctrlpipe (serial->dev, 0), | 391 | i = usb_control_msg (serial->dev, usb_rcvctrlpipe (serial->dev, 0), |
394 | GET_LINE_REQUEST, GET_LINE_REQUEST_TYPE, | 392 | GET_LINE_REQUEST, GET_LINE_REQUEST_TYPE, |
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index c18db3257073..c3a2071b802d 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -416,12 +416,11 @@ static int ti_startup(struct usb_serial *serial) | |||
416 | dev->actconfig->desc.bConfigurationValue); | 416 | dev->actconfig->desc.bConfigurationValue); |
417 | 417 | ||
418 | /* create device structure */ | 418 | /* create device structure */ |
419 | tdev = kmalloc(sizeof(struct ti_device), GFP_KERNEL); | 419 | tdev = kzalloc(sizeof(struct ti_device), GFP_KERNEL); |
420 | if (tdev == NULL) { | 420 | if (tdev == NULL) { |
421 | dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__); | 421 | dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__); |
422 | return -ENOMEM; | 422 | return -ENOMEM; |
423 | } | 423 | } |
424 | memset(tdev, 0, sizeof(struct ti_device)); | ||
425 | sema_init(&tdev->td_open_close_sem, 1); | 424 | sema_init(&tdev->td_open_close_sem, 1); |
426 | tdev->td_serial = serial; | 425 | tdev->td_serial = serial; |
427 | usb_set_serial_data(serial, tdev); | 426 | usb_set_serial_data(serial, tdev); |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index b5c96e74a903..097f4e8488fe 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -564,12 +564,11 @@ static struct usb_serial * create_serial (struct usb_device *dev, | |||
564 | { | 564 | { |
565 | struct usb_serial *serial; | 565 | struct usb_serial *serial; |
566 | 566 | ||
567 | serial = kmalloc (sizeof (*serial), GFP_KERNEL); | 567 | serial = kzalloc(sizeof(*serial), GFP_KERNEL); |
568 | if (!serial) { | 568 | if (!serial) { |
569 | dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__); | 569 | dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__); |
570 | return NULL; | 570 | return NULL; |
571 | } | 571 | } |
572 | memset (serial, 0, sizeof(*serial)); | ||
573 | serial->dev = usb_get_dev(dev); | 572 | serial->dev = usb_get_dev(dev); |
574 | serial->type = driver; | 573 | serial->type = driver; |
575 | serial->interface = interface; | 574 | serial->interface = interface; |
@@ -778,10 +777,9 @@ int usb_serial_probe(struct usb_interface *interface, | |||
778 | serial->num_port_pointers = max_endpoints; | 777 | serial->num_port_pointers = max_endpoints; |
779 | dbg("%s - setting up %d port structures for this device", __FUNCTION__, max_endpoints); | 778 | dbg("%s - setting up %d port structures for this device", __FUNCTION__, max_endpoints); |
780 | for (i = 0; i < max_endpoints; ++i) { | 779 | for (i = 0; i < max_endpoints; ++i) { |
781 | port = kmalloc(sizeof(struct usb_serial_port), GFP_KERNEL); | 780 | port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL); |
782 | if (!port) | 781 | if (!port) |
783 | goto probe_error; | 782 | goto probe_error; |
784 | memset(port, 0x00, sizeof(struct usb_serial_port)); | ||
785 | port->number = i + serial->minor; | 783 | port->number = i + serial->minor; |
786 | port->serial = serial; | 784 | port->serial = serial; |
787 | spin_lock_init(&port->lock); | 785 | spin_lock_init(&port->lock); |
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index 11a48d874752..f5c3841d4843 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c | |||
@@ -763,10 +763,9 @@ static int generic_startup(struct usb_serial *serial) | |||
763 | int i; | 763 | int i; |
764 | 764 | ||
765 | for (i = 0; i < serial->num_ports; ++i) { | 765 | for (i = 0; i < serial->num_ports; ++i) { |
766 | priv = kmalloc (sizeof(*priv), GFP_KERNEL); | 766 | priv = kzalloc (sizeof(*priv), GFP_KERNEL); |
767 | if (!priv) | 767 | if (!priv) |
768 | return -ENOMEM; | 768 | return -ENOMEM; |
769 | memset (priv, 0x00, sizeof(*priv)); | ||
770 | spin_lock_init(&priv->lock); | 769 | spin_lock_init(&priv->lock); |
771 | usb_set_serial_port_data(serial->port[i], priv); | 770 | usb_set_serial_port_data(serial->port[i], priv); |
772 | } | 771 | } |
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c index 7308e8cbe8f9..6831dca93c1b 100644 --- a/drivers/usb/storage/isd200.c +++ b/drivers/usb/storage/isd200.c | |||
@@ -1382,7 +1382,7 @@ static int isd200_init_info(struct us_data *us) | |||
1382 | } else | 1382 | } else |
1383 | US_DEBUGP("ERROR - kmalloc failure\n"); | 1383 | US_DEBUGP("ERROR - kmalloc failure\n"); |
1384 | 1384 | ||
1385 | return(retStatus); | 1385 | return retStatus; |
1386 | } | 1386 | } |
1387 | 1387 | ||
1388 | /************************************************************************** | 1388 | /************************************************************************** |