diff options
author | Yoann Padioleau <padator@wanadoo.fr> | 2007-07-19 04:49:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 13:04:50 -0400 |
commit | dd00cc486ab1c17049a535413d1751ef3482141c (patch) | |
tree | d90ff69ea06792b9284f2f2665c96624f121b88a /drivers | |
parent | 3b5ad0797c0e4049001f961a8b58f1d0ce532072 (diff) |
some kmalloc/memset ->kzalloc (tree wide)
Transform some calls to kmalloc/memset to a single kzalloc (or kcalloc).
Here is a short excerpt of the semantic patch performing
this transformation:
@@
type T2;
expression x;
identifier f,fld;
expression E;
expression E1,E2;
expression e1,e2,e3,y;
statement S;
@@
x =
- kmalloc
+ kzalloc
(E1,E2)
... when != \(x->fld=E;\|y=f(...,x,...);\|f(...,x,...);\|x=E;\|while(...) S\|for(e1;e2;e3) S\)
- memset((T2)x,0,E1);
@@
expression E1,E2,E3;
@@
- kzalloc(E1 * E2,E3)
+ kcalloc(E1,E2,E3)
[akpm@linux-foundation.org: get kcalloc args the right way around]
Signed-off-by: Yoann Padioleau <padator@wanadoo.fr>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Acked-by: Russell King <rmk@arm.linux.org.uk>
Cc: Bryan Wu <bryan.wu@analog.com>
Acked-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Dave Airlie <airlied@linux.ie>
Acked-by: Roland Dreier <rolandd@cisco.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Acked-by: Pierre Ossman <drzeus-list@drzeus.cx>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: "David S. Miller" <davem@davemloft.net>
Acked-by: Greg KH <greg@kroah.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
118 files changed, 135 insertions, 282 deletions
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c index 54509eb3391b..949ae93499e5 100644 --- a/drivers/block/sx8.c +++ b/drivers/block/sx8.c | |||
@@ -1608,7 +1608,7 @@ static int carm_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1608 | } | 1608 | } |
1609 | #endif | 1609 | #endif |
1610 | 1610 | ||
1611 | host = kmalloc(sizeof(*host), GFP_KERNEL); | 1611 | host = kzalloc(sizeof(*host), GFP_KERNEL); |
1612 | if (!host) { | 1612 | if (!host) { |
1613 | printk(KERN_ERR DRV_NAME "(%s): memory alloc failure\n", | 1613 | printk(KERN_ERR DRV_NAME "(%s): memory alloc failure\n", |
1614 | pci_name(pdev)); | 1614 | pci_name(pdev)); |
@@ -1616,7 +1616,6 @@ static int carm_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1616 | goto err_out_regions; | 1616 | goto err_out_regions; |
1617 | } | 1617 | } |
1618 | 1618 | ||
1619 | memset(host, 0, sizeof(*host)); | ||
1620 | host->pdev = pdev; | 1619 | host->pdev = pdev; |
1621 | host->flags = pci_dac ? FL_DAC : 0; | 1620 | host->flags = pci_dac ? FL_DAC : 0; |
1622 | spin_lock_init(&host->lock); | 1621 | spin_lock_init(&host->lock); |
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c index 7b02bf1289a2..3d468f502d2d 100644 --- a/drivers/char/amiserial.c +++ b/drivers/char/amiserial.c | |||
@@ -1721,12 +1721,11 @@ static int get_async_struct(int line, struct async_struct **ret_info) | |||
1721 | *ret_info = sstate->info; | 1721 | *ret_info = sstate->info; |
1722 | return 0; | 1722 | return 0; |
1723 | } | 1723 | } |
1724 | info = kmalloc(sizeof(struct async_struct), GFP_KERNEL); | 1724 | info = kzalloc(sizeof(struct async_struct), GFP_KERNEL); |
1725 | if (!info) { | 1725 | if (!info) { |
1726 | sstate->count--; | 1726 | sstate->count--; |
1727 | return -ENOMEM; | 1727 | return -ENOMEM; |
1728 | } | 1728 | } |
1729 | memset(info, 0, sizeof(struct async_struct)); | ||
1730 | #ifdef DECLARE_WAITQUEUE | 1729 | #ifdef DECLARE_WAITQUEUE |
1731 | init_waitqueue_head(&info->open_wait); | 1730 | init_waitqueue_head(&info->open_wait); |
1732 | init_waitqueue_head(&info->close_wait); | 1731 | init_waitqueue_head(&info->close_wait); |
diff --git a/drivers/char/drm/via_dmablit.c b/drivers/char/drm/via_dmablit.c index fdb8609dd76f..832de1d9ba7e 100644 --- a/drivers/char/drm/via_dmablit.c +++ b/drivers/char/drm/via_dmablit.c | |||
@@ -273,10 +273,9 @@ via_alloc_desc_pages(drm_via_sg_info_t *vsg) | |||
273 | vsg->num_desc_pages = (vsg->num_desc + vsg->descriptors_per_page - 1) / | 273 | vsg->num_desc_pages = (vsg->num_desc + vsg->descriptors_per_page - 1) / |
274 | vsg->descriptors_per_page; | 274 | vsg->descriptors_per_page; |
275 | 275 | ||
276 | if (NULL == (vsg->desc_pages = kmalloc(sizeof(void *) * vsg->num_desc_pages, GFP_KERNEL))) | 276 | if (NULL == (vsg->desc_pages = kcalloc(vsg->num_desc_pages, sizeof(void *), GFP_KERNEL))) |
277 | return DRM_ERR(ENOMEM); | 277 | return DRM_ERR(ENOMEM); |
278 | 278 | ||
279 | memset(vsg->desc_pages, 0, sizeof(void *) * vsg->num_desc_pages); | ||
280 | vsg->state = dr_via_desc_pages_alloc; | 279 | vsg->state = dr_via_desc_pages_alloc; |
281 | for (i=0; i<vsg->num_desc_pages; ++i) { | 280 | for (i=0; i<vsg->num_desc_pages; ++i) { |
282 | if (NULL == (vsg->desc_pages[i] = | 281 | if (NULL == (vsg->desc_pages[i] = |
diff --git a/drivers/char/esp.c b/drivers/char/esp.c index 74cd5118af57..2e7ae42a5503 100644 --- a/drivers/char/esp.c +++ b/drivers/char/esp.c | |||
@@ -2459,7 +2459,7 @@ static int __init espserial_init(void) | |||
2459 | return 1; | 2459 | return 1; |
2460 | } | 2460 | } |
2461 | 2461 | ||
2462 | info = kmalloc(sizeof(struct esp_struct), GFP_KERNEL); | 2462 | info = kzalloc(sizeof(struct esp_struct), GFP_KERNEL); |
2463 | 2463 | ||
2464 | if (!info) | 2464 | if (!info) |
2465 | { | 2465 | { |
@@ -2469,7 +2469,6 @@ static int __init espserial_init(void) | |||
2469 | return 1; | 2469 | return 1; |
2470 | } | 2470 | } |
2471 | 2471 | ||
2472 | memset((void *)info, 0, sizeof(struct esp_struct)); | ||
2473 | spin_lock_init(&info->lock); | 2472 | spin_lock_init(&info->lock); |
2474 | /* rx_trigger, tx_trigger are needed by autoconfig */ | 2473 | /* rx_trigger, tx_trigger are needed by autoconfig */ |
2475 | info->config.rx_trigger = rx_trigger; | 2474 | info->config.rx_trigger = rx_trigger; |
@@ -2527,7 +2526,7 @@ static int __init espserial_init(void) | |||
2527 | if (!dma) | 2526 | if (!dma) |
2528 | info->stat_flags |= ESP_STAT_NEVER_DMA; | 2527 | info->stat_flags |= ESP_STAT_NEVER_DMA; |
2529 | 2528 | ||
2530 | info = kmalloc(sizeof(struct esp_struct), GFP_KERNEL); | 2529 | info = kzalloc(sizeof(struct esp_struct), GFP_KERNEL); |
2531 | if (!info) | 2530 | if (!info) |
2532 | { | 2531 | { |
2533 | printk(KERN_ERR "Couldn't allocate memory for esp serial device information\n"); | 2532 | printk(KERN_ERR "Couldn't allocate memory for esp serial device information\n"); |
@@ -2536,7 +2535,6 @@ static int __init espserial_init(void) | |||
2536 | return 0; | 2535 | return 0; |
2537 | } | 2536 | } |
2538 | 2537 | ||
2539 | memset((void *)info, 0, sizeof(struct esp_struct)); | ||
2540 | /* rx_trigger, tx_trigger are needed by autoconfig */ | 2538 | /* rx_trigger, tx_trigger are needed by autoconfig */ |
2541 | info->config.rx_trigger = rx_trigger; | 2539 | info->config.rx_trigger = rx_trigger; |
2542 | info->config.tx_trigger = tx_trigger; | 2540 | info->config.tx_trigger = tx_trigger; |
diff --git a/drivers/char/hvcs.c b/drivers/char/hvcs.c index 207f7343ba60..17f96e04266f 100644 --- a/drivers/char/hvcs.c +++ b/drivers/char/hvcs.c | |||
@@ -784,12 +784,10 @@ static int __devinit hvcs_probe( | |||
784 | return -EFAULT; | 784 | return -EFAULT; |
785 | } | 785 | } |
786 | 786 | ||
787 | hvcsd = kmalloc(sizeof(*hvcsd), GFP_KERNEL); | 787 | hvcsd = kzalloc(sizeof(*hvcsd), GFP_KERNEL); |
788 | if (!hvcsd) | 788 | if (!hvcsd) |
789 | return -ENODEV; | 789 | return -ENODEV; |
790 | 790 | ||
791 | /* hvcsd->tty is zeroed out with the memset */ | ||
792 | memset(hvcsd, 0x00, sizeof(*hvcsd)); | ||
793 | 791 | ||
794 | spin_lock_init(&hvcsd->lock); | 792 | spin_lock_init(&hvcsd->lock); |
795 | /* Automatically incs the refcount the first time */ | 793 | /* Automatically incs the refcount the first time */ |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index b5df7e61aeb2..6a01dd9e43f8 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -2639,10 +2639,9 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers, | |||
2639 | return -ENODEV; | 2639 | return -ENODEV; |
2640 | } | 2640 | } |
2641 | 2641 | ||
2642 | intf = kmalloc(sizeof(*intf), GFP_KERNEL); | 2642 | intf = kzalloc(sizeof(*intf), GFP_KERNEL); |
2643 | if (!intf) | 2643 | if (!intf) |
2644 | return -ENOMEM; | 2644 | return -ENOMEM; |
2645 | memset(intf, 0, sizeof(*intf)); | ||
2646 | 2645 | ||
2647 | intf->ipmi_version_major = ipmi_version_major(device_id); | 2646 | intf->ipmi_version_major = ipmi_version_major(device_id); |
2648 | intf->ipmi_version_minor = ipmi_version_minor(device_id); | 2647 | intf->ipmi_version_minor = ipmi_version_minor(device_id); |
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 13808f6083a0..2b889317461e 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -540,13 +540,12 @@ static int mgslpc_probe(struct pcmcia_device *link) | |||
540 | if (debug_level >= DEBUG_LEVEL_INFO) | 540 | if (debug_level >= DEBUG_LEVEL_INFO) |
541 | printk("mgslpc_attach\n"); | 541 | printk("mgslpc_attach\n"); |
542 | 542 | ||
543 | info = kmalloc(sizeof(MGSLPC_INFO), GFP_KERNEL); | 543 | info = kzalloc(sizeof(MGSLPC_INFO), GFP_KERNEL); |
544 | if (!info) { | 544 | if (!info) { |
545 | printk("Error can't allocate device instance data\n"); | 545 | printk("Error can't allocate device instance data\n"); |
546 | return -ENOMEM; | 546 | return -ENOMEM; |
547 | } | 547 | } |
548 | 548 | ||
549 | memset(info, 0, sizeof(MGSLPC_INFO)); | ||
550 | info->magic = MGSLPC_MAGIC; | 549 | info->magic = MGSLPC_MAGIC; |
551 | INIT_WORK(&info->task, bh_handler); | 550 | INIT_WORK(&info->task, bh_handler); |
552 | info->max_frame_size = 4096; | 551 | info->max_frame_size = 4096; |
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index 294e9cb0c449..0ce96670f979 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c | |||
@@ -803,9 +803,7 @@ static void *ckmalloc(int size) | |||
803 | { | 803 | { |
804 | void *p; | 804 | void *p; |
805 | 805 | ||
806 | p = kmalloc(size, GFP_KERNEL); | 806 | p = kzalloc(size, GFP_KERNEL); |
807 | if (p) | ||
808 | memset(p, 0, size); | ||
809 | return p; | 807 | return p; |
810 | } | 808 | } |
811 | 809 | ||
diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c index 8cc60b693460..7321d002c34f 100644 --- a/drivers/char/rio/riocmd.c +++ b/drivers/char/rio/riocmd.c | |||
@@ -556,9 +556,7 @@ struct CmdBlk *RIOGetCmdBlk(void) | |||
556 | { | 556 | { |
557 | struct CmdBlk *CmdBlkP; | 557 | struct CmdBlk *CmdBlkP; |
558 | 558 | ||
559 | CmdBlkP = kmalloc(sizeof(struct CmdBlk), GFP_ATOMIC); | 559 | CmdBlkP = kzalloc(sizeof(struct CmdBlk), GFP_ATOMIC); |
560 | if (CmdBlkP) | ||
561 | memset(CmdBlkP, 0, sizeof(struct CmdBlk)); | ||
562 | return CmdBlkP; | 560 | return CmdBlkP; |
563 | } | 561 | } |
564 | 562 | ||
diff --git a/drivers/char/rio/riotable.c b/drivers/char/rio/riotable.c index 7e988357326e..991119c9f473 100644 --- a/drivers/char/rio/riotable.c +++ b/drivers/char/rio/riotable.c | |||
@@ -863,8 +863,7 @@ int RIOReMapPorts(struct rio_info *p, struct Host *HostP, struct Map *HostMapP) | |||
863 | if (PortP->TxRingBuffer) | 863 | if (PortP->TxRingBuffer) |
864 | memset(PortP->TxRingBuffer, 0, p->RIOBufferSize); | 864 | memset(PortP->TxRingBuffer, 0, p->RIOBufferSize); |
865 | else if (p->RIOBufferSize) { | 865 | else if (p->RIOBufferSize) { |
866 | PortP->TxRingBuffer = kmalloc(p->RIOBufferSize, GFP_KERNEL); | 866 | PortP->TxRingBuffer = kzalloc(p->RIOBufferSize, GFP_KERNEL); |
867 | memset(PortP->TxRingBuffer, 0, p->RIOBufferSize); | ||
868 | } | 867 | } |
869 | PortP->TxBufferOut = 0; | 868 | PortP->TxBufferOut = 0; |
870 | PortP->TxBufferIn = 0; | 869 | PortP->TxBufferIn = 0; |
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 0270080ff0c0..56cbba7b6ec0 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c | |||
@@ -635,12 +635,11 @@ static void init_r_port(int board, int aiop, int chan, struct pci_dev *pci_dev) | |||
635 | ctlp = sCtlNumToCtlPtr(board); | 635 | ctlp = sCtlNumToCtlPtr(board); |
636 | 636 | ||
637 | /* Get a r_port struct for the port, fill it in and save it globally, indexed by line number */ | 637 | /* Get a r_port struct for the port, fill it in and save it globally, indexed by line number */ |
638 | info = kmalloc(sizeof (struct r_port), GFP_KERNEL); | 638 | info = kzalloc(sizeof (struct r_port), GFP_KERNEL); |
639 | if (!info) { | 639 | if (!info) { |
640 | printk(KERN_INFO "Couldn't allocate info struct for line #%d\n", line); | 640 | printk(KERN_INFO "Couldn't allocate info struct for line #%d\n", line); |
641 | return; | 641 | return; |
642 | } | 642 | } |
643 | memset(info, 0, sizeof (struct r_port)); | ||
644 | 643 | ||
645 | info->magic = RPORT_MAGIC; | 644 | info->magic = RPORT_MAGIC; |
646 | info->line = line; | 645 | info->line = line; |
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index f53e51ddb9d7..fdc256b380b8 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -4324,13 +4324,12 @@ static struct mgsl_struct* mgsl_allocate_device(void) | |||
4324 | { | 4324 | { |
4325 | struct mgsl_struct *info; | 4325 | struct mgsl_struct *info; |
4326 | 4326 | ||
4327 | info = kmalloc(sizeof(struct mgsl_struct), | 4327 | info = kzalloc(sizeof(struct mgsl_struct), |
4328 | GFP_KERNEL); | 4328 | GFP_KERNEL); |
4329 | 4329 | ||
4330 | if (!info) { | 4330 | if (!info) { |
4331 | printk("Error can't allocate device instance data\n"); | 4331 | printk("Error can't allocate device instance data\n"); |
4332 | } else { | 4332 | } else { |
4333 | memset(info, 0, sizeof(struct mgsl_struct)); | ||
4334 | info->magic = MGSL_MAGIC; | 4333 | info->magic = MGSL_MAGIC; |
4335 | INIT_WORK(&info->task, mgsl_bh_handler); | 4334 | INIT_WORK(&info->task, mgsl_bh_handler); |
4336 | info->max_frame_size = 4096; | 4335 | info->max_frame_size = 4096; |
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index 428b514201f4..372a37e25620 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -3414,13 +3414,12 @@ static struct slgt_info *alloc_dev(int adapter_num, int port_num, struct pci_dev | |||
3414 | { | 3414 | { |
3415 | struct slgt_info *info; | 3415 | struct slgt_info *info; |
3416 | 3416 | ||
3417 | info = kmalloc(sizeof(struct slgt_info), GFP_KERNEL); | 3417 | info = kzalloc(sizeof(struct slgt_info), GFP_KERNEL); |
3418 | 3418 | ||
3419 | if (!info) { | 3419 | if (!info) { |
3420 | DBGERR(("%s device alloc failed adapter=%d port=%d\n", | 3420 | DBGERR(("%s device alloc failed adapter=%d port=%d\n", |
3421 | driver_name, adapter_num, port_num)); | 3421 | driver_name, adapter_num, port_num)); |
3422 | } else { | 3422 | } else { |
3423 | memset(info, 0, sizeof(struct slgt_info)); | ||
3424 | info->magic = MGSL_MAGIC; | 3423 | info->magic = MGSL_MAGIC; |
3425 | INIT_WORK(&info->task, bh_handler); | 3424 | INIT_WORK(&info->task, bh_handler); |
3426 | info->max_frame_size = 4096; | 3425 | info->max_frame_size = 4096; |
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index a65407b32079..c63013b2fc36 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -3786,14 +3786,13 @@ static SLMP_INFO *alloc_dev(int adapter_num, int port_num, struct pci_dev *pdev) | |||
3786 | { | 3786 | { |
3787 | SLMP_INFO *info; | 3787 | SLMP_INFO *info; |
3788 | 3788 | ||
3789 | info = kmalloc(sizeof(SLMP_INFO), | 3789 | info = kzalloc(sizeof(SLMP_INFO), |
3790 | GFP_KERNEL); | 3790 | GFP_KERNEL); |
3791 | 3791 | ||
3792 | if (!info) { | 3792 | if (!info) { |
3793 | printk("%s(%d) Error can't allocate device instance data for adapter %d, port %d\n", | 3793 | printk("%s(%d) Error can't allocate device instance data for adapter %d, port %d\n", |
3794 | __FILE__,__LINE__, adapter_num, port_num); | 3794 | __FILE__,__LINE__, adapter_num, port_num); |
3795 | } else { | 3795 | } else { |
3796 | memset(info, 0, sizeof(SLMP_INFO)); | ||
3797 | info->magic = MGSL_MAGIC; | 3796 | info->magic = MGSL_MAGIC; |
3798 | INIT_WORK(&info->task, bh_handler); | 3797 | INIT_WORK(&info->task, bh_handler); |
3799 | info->max_frame_size = 4096; | 3798 | info->max_frame_size = 4096; |
diff --git a/drivers/char/watchdog/mpcore_wdt.c b/drivers/char/watchdog/mpcore_wdt.c index e88947f8fe53..0d2b27735419 100644 --- a/drivers/char/watchdog/mpcore_wdt.c +++ b/drivers/char/watchdog/mpcore_wdt.c | |||
@@ -328,12 +328,11 @@ static int __devinit mpcore_wdt_probe(struct platform_device *dev) | |||
328 | goto err_out; | 328 | goto err_out; |
329 | } | 329 | } |
330 | 330 | ||
331 | wdt = kmalloc(sizeof(struct mpcore_wdt), GFP_KERNEL); | 331 | wdt = kzalloc(sizeof(struct mpcore_wdt), GFP_KERNEL); |
332 | if (!wdt) { | 332 | if (!wdt) { |
333 | ret = -ENOMEM; | 333 | ret = -ENOMEM; |
334 | goto err_out; | 334 | goto err_out; |
335 | } | 335 | } |
336 | memset(wdt, 0, sizeof(struct mpcore_wdt)); | ||
337 | 336 | ||
338 | wdt->dev = &dev->dev; | 337 | wdt->dev = &dev->dev; |
339 | wdt->irq = platform_get_irq(dev, 0); | 338 | wdt->irq = platform_get_irq(dev, 0); |
diff --git a/drivers/char/watchdog/pcwd_usb.c b/drivers/char/watchdog/pcwd_usb.c index 1e7a6719d5ba..0f3fd6c9c354 100644 --- a/drivers/char/watchdog/pcwd_usb.c +++ b/drivers/char/watchdog/pcwd_usb.c | |||
@@ -626,12 +626,11 @@ static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_devi | |||
626 | maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); | 626 | maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); |
627 | 627 | ||
628 | /* allocate memory for our device and initialize it */ | 628 | /* allocate memory for our device and initialize it */ |
629 | usb_pcwd = kmalloc (sizeof(struct usb_pcwd_private), GFP_KERNEL); | 629 | usb_pcwd = kzalloc (sizeof(struct usb_pcwd_private), GFP_KERNEL); |
630 | if (usb_pcwd == NULL) { | 630 | if (usb_pcwd == NULL) { |
631 | printk(KERN_ERR PFX "Out of memory\n"); | 631 | printk(KERN_ERR PFX "Out of memory\n"); |
632 | goto error; | 632 | goto error; |
633 | } | 633 | } |
634 | memset (usb_pcwd, 0x00, sizeof (*usb_pcwd)); | ||
635 | 634 | ||
636 | usb_pcwd_device = usb_pcwd; | 635 | usb_pcwd_device = usb_pcwd; |
637 | 636 | ||
diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c index 6e935d7c63fd..c2e29571b007 100644 --- a/drivers/ide/mips/swarm.c +++ b/drivers/ide/mips/swarm.c | |||
@@ -165,12 +165,11 @@ static int __devinit swarm_ide_init_module(void) | |||
165 | goto out; | 165 | goto out; |
166 | } | 166 | } |
167 | 167 | ||
168 | if (!(pldev = kmalloc(sizeof (*pldev), GFP_KERNEL))) { | 168 | if (!(pldev = kzalloc(sizeof (*pldev), GFP_KERNEL))) { |
169 | err = -ENOMEM; | 169 | err = -ENOMEM; |
170 | goto out_unregister_driver; | 170 | goto out_unregister_driver; |
171 | } | 171 | } |
172 | 172 | ||
173 | memset (pldev, 0, sizeof (*pldev)); | ||
174 | pldev->name = swarm_ide_string; | 173 | pldev->name = swarm_ide_string; |
175 | pldev->id = 0; | 174 | pldev->id = 0; |
176 | pldev->dev.release = swarm_ide_platform_release; | 175 | pldev->dev.release = swarm_ide_platform_release; |
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index a91001c59b69..c5c33d35f87d 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c | |||
@@ -295,10 +295,9 @@ int rdma_resolve_ip(struct rdma_addr_client *client, | |||
295 | struct addr_req *req; | 295 | struct addr_req *req; |
296 | int ret = 0; | 296 | int ret = 0; |
297 | 297 | ||
298 | req = kmalloc(sizeof *req, GFP_KERNEL); | 298 | req = kzalloc(sizeof *req, GFP_KERNEL); |
299 | if (!req) | 299 | if (!req) |
300 | return -ENOMEM; | 300 | return -ENOMEM; |
301 | memset(req, 0, sizeof *req); | ||
302 | 301 | ||
303 | if (src_addr) | 302 | if (src_addr) |
304 | memcpy(&req->src_addr, src_addr, ip_addr_size(src_addr)); | 303 | memcpy(&req->src_addr, src_addr, ip_addr_size(src_addr)); |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c index 5dc68cd5621b..9574088f0d4e 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_cm.c +++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c | |||
@@ -229,9 +229,8 @@ static void *alloc_ep(int size, gfp_t gfp) | |||
229 | { | 229 | { |
230 | struct iwch_ep_common *epc; | 230 | struct iwch_ep_common *epc; |
231 | 231 | ||
232 | epc = kmalloc(size, gfp); | 232 | epc = kzalloc(size, gfp); |
233 | if (epc) { | 233 | if (epc) { |
234 | memset(epc, 0, size); | ||
235 | kref_init(&epc->kref); | 234 | kref_init(&epc->kref); |
236 | spin_lock_init(&epc->lock); | 235 | spin_lock_init(&epc->lock); |
237 | init_waitqueue_head(&epc->waitq); | 236 | init_waitqueue_head(&epc->waitq); |
diff --git a/drivers/input/serio/ambakmi.c b/drivers/input/serio/ambakmi.c index 5a7b49c35539..b10ffae7c39b 100644 --- a/drivers/input/serio/ambakmi.c +++ b/drivers/input/serio/ambakmi.c | |||
@@ -117,15 +117,13 @@ static int amba_kmi_probe(struct amba_device *dev, void *id) | |||
117 | if (ret) | 117 | if (ret) |
118 | return ret; | 118 | return ret; |
119 | 119 | ||
120 | kmi = kmalloc(sizeof(struct amba_kmi_port), GFP_KERNEL); | 120 | kmi = kzalloc(sizeof(struct amba_kmi_port), GFP_KERNEL); |
121 | io = kmalloc(sizeof(struct serio), GFP_KERNEL); | 121 | io = kzalloc(sizeof(struct serio), GFP_KERNEL); |
122 | if (!kmi || !io) { | 122 | if (!kmi || !io) { |
123 | ret = -ENOMEM; | 123 | ret = -ENOMEM; |
124 | goto out; | 124 | goto out; |
125 | } | 125 | } |
126 | 126 | ||
127 | memset(kmi, 0, sizeof(struct amba_kmi_port)); | ||
128 | memset(io, 0, sizeof(struct serio)); | ||
129 | 127 | ||
130 | io->id.type = SERIO_8042; | 128 | io->id.type = SERIO_8042; |
131 | io->write = amba_kmi_write; | 129 | io->write = amba_kmi_write; |
diff --git a/drivers/input/serio/pcips2.c b/drivers/input/serio/pcips2.c index ea5e3c6ddb62..1b404f9e3bff 100644 --- a/drivers/input/serio/pcips2.c +++ b/drivers/input/serio/pcips2.c | |||
@@ -140,15 +140,13 @@ static int __devinit pcips2_probe(struct pci_dev *dev, const struct pci_device_i | |||
140 | if (ret) | 140 | if (ret) |
141 | goto disable; | 141 | goto disable; |
142 | 142 | ||
143 | ps2if = kmalloc(sizeof(struct pcips2_data), GFP_KERNEL); | 143 | ps2if = kzalloc(sizeof(struct pcips2_data), GFP_KERNEL); |
144 | serio = kmalloc(sizeof(struct serio), GFP_KERNEL); | 144 | serio = kzalloc(sizeof(struct serio), GFP_KERNEL); |
145 | if (!ps2if || !serio) { | 145 | if (!ps2if || !serio) { |
146 | ret = -ENOMEM; | 146 | ret = -ENOMEM; |
147 | goto release; | 147 | goto release; |
148 | } | 148 | } |
149 | 149 | ||
150 | memset(ps2if, 0, sizeof(struct pcips2_data)); | ||
151 | memset(serio, 0, sizeof(struct serio)); | ||
152 | 150 | ||
153 | serio->id.type = SERIO_8042; | 151 | serio->id.type = SERIO_8042; |
154 | serio->write = pcips2_write; | 152 | serio->write = pcips2_write; |
diff --git a/drivers/input/serio/sa1111ps2.c b/drivers/input/serio/sa1111ps2.c index d31ece8f68e9..2ad88780a170 100644 --- a/drivers/input/serio/sa1111ps2.c +++ b/drivers/input/serio/sa1111ps2.c | |||
@@ -234,15 +234,13 @@ static int __devinit ps2_probe(struct sa1111_dev *dev) | |||
234 | struct serio *serio; | 234 | struct serio *serio; |
235 | int ret; | 235 | int ret; |
236 | 236 | ||
237 | ps2if = kmalloc(sizeof(struct ps2if), GFP_KERNEL); | 237 | ps2if = kzalloc(sizeof(struct ps2if), GFP_KERNEL); |
238 | serio = kmalloc(sizeof(struct serio), GFP_KERNEL); | 238 | serio = kzalloc(sizeof(struct serio), GFP_KERNEL); |
239 | if (!ps2if || !serio) { | 239 | if (!ps2if || !serio) { |
240 | ret = -ENOMEM; | 240 | ret = -ENOMEM; |
241 | goto free; | 241 | goto free; |
242 | } | 242 | } |
243 | 243 | ||
244 | memset(ps2if, 0, sizeof(struct ps2if)); | ||
245 | memset(serio, 0, sizeof(struct serio)); | ||
246 | 244 | ||
247 | serio->id.type = SERIO_8042; | 245 | serio->id.type = SERIO_8042; |
248 | serio->write = ps2_write; | 246 | serio->write = ps2_write; |
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index c96b7fe882a4..ec9e5f32f0ae 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c | |||
@@ -365,10 +365,9 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, | |||
365 | if (np == NULL) | 365 | if (np == NULL) |
366 | return NULL; | 366 | return NULL; |
367 | 367 | ||
368 | dev = kmalloc(sizeof(*dev), GFP_KERNEL); | 368 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
369 | if (!dev) | 369 | if (!dev) |
370 | return NULL; | 370 | return NULL; |
371 | memset(dev, 0, sizeof(*dev)); | ||
372 | 371 | ||
373 | dev->bus = &chip->lbus; | 372 | dev->bus = &chip->lbus; |
374 | dev->media_bay = in_bay; | 373 | dev->media_bay = in_bay; |
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c index f8e1a135bf9d..d409f6759482 100644 --- a/drivers/macintosh/smu.c +++ b/drivers/macintosh/smu.c | |||
@@ -1053,10 +1053,9 @@ static int smu_open(struct inode *inode, struct file *file) | |||
1053 | struct smu_private *pp; | 1053 | struct smu_private *pp; |
1054 | unsigned long flags; | 1054 | unsigned long flags; |
1055 | 1055 | ||
1056 | pp = kmalloc(sizeof(struct smu_private), GFP_KERNEL); | 1056 | pp = kzalloc(sizeof(struct smu_private), GFP_KERNEL); |
1057 | if (pp == 0) | 1057 | if (pp == 0) |
1058 | return -ENOMEM; | 1058 | return -ENOMEM; |
1059 | memset(pp, 0, sizeof(struct smu_private)); | ||
1060 | spin_lock_init(&pp->lock); | 1059 | spin_lock_init(&pp->lock); |
1061 | pp->mode = smu_file_commands; | 1060 | pp->mode = smu_file_commands; |
1062 | init_waitqueue_head(&pp->wait); | 1061 | init_waitqueue_head(&pp->wait); |
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index 3d90fc002097..e43554e754a4 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c | |||
@@ -318,10 +318,9 @@ static struct i2c_client *attach_i2c_chip(int id, const char *name) | |||
318 | if (adap == NULL) | 318 | if (adap == NULL) |
319 | return NULL; | 319 | return NULL; |
320 | 320 | ||
321 | clt = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 321 | clt = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
322 | if (clt == NULL) | 322 | if (clt == NULL) |
323 | return NULL; | 323 | return NULL; |
324 | memset(clt, 0, sizeof(struct i2c_client)); | ||
325 | 324 | ||
326 | clt->addr = (id >> 1) & 0x7f; | 325 | clt->addr = (id >> 1) & 0x7f; |
327 | clt->adapter = adap; | 326 | clt->adapter = adap; |
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c index 3d0354e96a97..5452da1bb1a5 100644 --- a/drivers/macintosh/therm_windtunnel.c +++ b/drivers/macintosh/therm_windtunnel.c | |||
@@ -431,9 +431,8 @@ do_probe( struct i2c_adapter *adapter, int addr, int kind ) | |||
431 | | I2C_FUNC_SMBUS_WRITE_BYTE) ) | 431 | | I2C_FUNC_SMBUS_WRITE_BYTE) ) |
432 | return 0; | 432 | return 0; |
433 | 433 | ||
434 | if( !(cl=kmalloc(sizeof(*cl), GFP_KERNEL)) ) | 434 | if( !(cl=kzalloc(sizeof(*cl), GFP_KERNEL)) ) |
435 | return -ENOMEM; | 435 | return -ENOMEM; |
436 | memset( cl, 0, sizeof(struct i2c_client) ); | ||
437 | 436 | ||
438 | cl->addr = addr; | 437 | cl->addr = addr; |
439 | cl->adapter = adapter; | 438 | cl->adapter = adapter; |
diff --git a/drivers/macintosh/windfarm_lm75_sensor.c b/drivers/macintosh/windfarm_lm75_sensor.c index a0fabf3c2008..7e10c3ab4d50 100644 --- a/drivers/macintosh/windfarm_lm75_sensor.c +++ b/drivers/macintosh/windfarm_lm75_sensor.c | |||
@@ -117,10 +117,9 @@ static struct wf_lm75_sensor *wf_lm75_create(struct i2c_adapter *adapter, | |||
117 | DBG("wf_lm75: creating %s device at address 0x%02x\n", | 117 | DBG("wf_lm75: creating %s device at address 0x%02x\n", |
118 | ds1775 ? "ds1775" : "lm75", addr); | 118 | ds1775 ? "ds1775" : "lm75", addr); |
119 | 119 | ||
120 | lm = kmalloc(sizeof(struct wf_lm75_sensor), GFP_KERNEL); | 120 | lm = kzalloc(sizeof(struct wf_lm75_sensor), GFP_KERNEL); |
121 | if (lm == NULL) | 121 | if (lm == NULL) |
122 | return NULL; | 122 | return NULL; |
123 | memset(lm, 0, sizeof(struct wf_lm75_sensor)); | ||
124 | 123 | ||
125 | /* Usual rant about sensor names not beeing very consistent in | 124 | /* Usual rant about sensor names not beeing very consistent in |
126 | * the device-tree, oh well ... | 125 | * the device-tree, oh well ... |
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index 1a876f9965e0..144071e70a93 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
@@ -951,13 +951,12 @@ static struct mirror_set *alloc_context(unsigned int nr_mirrors, | |||
951 | 951 | ||
952 | len = sizeof(*ms) + (sizeof(ms->mirror[0]) * nr_mirrors); | 952 | len = sizeof(*ms) + (sizeof(ms->mirror[0]) * nr_mirrors); |
953 | 953 | ||
954 | ms = kmalloc(len, GFP_KERNEL); | 954 | ms = kzalloc(len, GFP_KERNEL); |
955 | if (!ms) { | 955 | if (!ms) { |
956 | ti->error = "Cannot allocate mirror context"; | 956 | ti->error = "Cannot allocate mirror context"; |
957 | return NULL; | 957 | return NULL; |
958 | } | 958 | } |
959 | 959 | ||
960 | memset(ms, 0, len); | ||
961 | spin_lock_init(&ms->lock); | 960 | spin_lock_init(&ms->lock); |
962 | 961 | ||
963 | ms->ti = ti; | 962 | ms->ti = ti; |
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c index 5a1449f485cf..28929b618e20 100644 --- a/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/drivers/media/dvb/cinergyT2/cinergyT2.c | |||
@@ -905,12 +905,11 @@ static int cinergyt2_probe (struct usb_interface *intf, | |||
905 | struct cinergyt2 *cinergyt2; | 905 | struct cinergyt2 *cinergyt2; |
906 | int err; | 906 | int err; |
907 | 907 | ||
908 | if (!(cinergyt2 = kmalloc (sizeof(struct cinergyt2), GFP_KERNEL))) { | 908 | if (!(cinergyt2 = kzalloc (sizeof(struct cinergyt2), GFP_KERNEL))) { |
909 | dprintk(1, "out of memory?!?\n"); | 909 | dprintk(1, "out of memory?!?\n"); |
910 | return -ENOMEM; | 910 | return -ENOMEM; |
911 | } | 911 | } |
912 | 912 | ||
913 | memset (cinergyt2, 0, sizeof (struct cinergyt2)); | ||
914 | usb_set_intfdata (intf, (void *) cinergyt2); | 913 | usb_set_intfdata (intf, (void *) cinergyt2); |
915 | 914 | ||
916 | mutex_init(&cinergyt2->sem); | 915 | mutex_init(&cinergyt2->sem); |
diff --git a/drivers/media/video/cpia2/cpia2_core.c b/drivers/media/video/cpia2/cpia2_core.c index 55aab8d38880..a76bd786cf13 100644 --- a/drivers/media/video/cpia2/cpia2_core.c +++ b/drivers/media/video/cpia2/cpia2_core.c | |||
@@ -2224,15 +2224,13 @@ struct camera_data *cpia2_init_camera_struct(void) | |||
2224 | { | 2224 | { |
2225 | struct camera_data *cam; | 2225 | struct camera_data *cam; |
2226 | 2226 | ||
2227 | cam = kmalloc(sizeof(*cam), GFP_KERNEL); | 2227 | cam = kzalloc(sizeof(*cam), GFP_KERNEL); |
2228 | 2228 | ||
2229 | if (!cam) { | 2229 | if (!cam) { |
2230 | ERR("couldn't kmalloc cpia2 struct\n"); | 2230 | ERR("couldn't kmalloc cpia2 struct\n"); |
2231 | return NULL; | 2231 | return NULL; |
2232 | } | 2232 | } |
2233 | 2233 | ||
2234 | /* Default everything to 0 */ | ||
2235 | memset(cam, 0, sizeof(struct camera_data)); | ||
2236 | 2234 | ||
2237 | cam->present = 1; | 2235 | cam->present = 1; |
2238 | mutex_init(&cam->busy_lock); | 2236 | mutex_init(&cam->busy_lock); |
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index 507b1d4260ed..11cfcf18ec34 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c | |||
@@ -812,10 +812,9 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind) | |||
812 | int msp_product, msp_prod_hi, msp_prod_lo; | 812 | int msp_product, msp_prod_hi, msp_prod_lo; |
813 | int msp_rom; | 813 | int msp_rom; |
814 | 814 | ||
815 | client = kmalloc(sizeof(*client), GFP_KERNEL); | 815 | client = kzalloc(sizeof(*client), GFP_KERNEL); |
816 | if (client == NULL) | 816 | if (client == NULL) |
817 | return -ENOMEM; | 817 | return -ENOMEM; |
818 | memset(client, 0, sizeof(*client)); | ||
819 | client->addr = address; | 818 | client->addr = address; |
820 | client->adapter = adapter; | 819 | client->adapter = adapter; |
821 | client->driver = &i2c_driver; | 820 | client->driver = &i2c_driver; |
diff --git a/drivers/media/video/planb.c b/drivers/media/video/planb.c index 1455a8f4e930..4ab1af74a970 100644 --- a/drivers/media/video/planb.c +++ b/drivers/media/video/planb.c | |||
@@ -353,9 +353,8 @@ static int planb_prepare_open(struct planb *pb) | |||
353 | * PLANB_DUMMY)*sizeof(struct dbdma_cmd) | 353 | * PLANB_DUMMY)*sizeof(struct dbdma_cmd) |
354 | +(PLANB_MAXLINES*((PLANB_MAXPIXELS+7)& ~7))/8 | 354 | +(PLANB_MAXLINES*((PLANB_MAXPIXELS+7)& ~7))/8 |
355 | +MAX_GBUFFERS*sizeof(unsigned int); | 355 | +MAX_GBUFFERS*sizeof(unsigned int); |
356 | if ((pb->priv_space = kmalloc (size, GFP_KERNEL)) == 0) | 356 | if ((pb->priv_space = kzalloc (size, GFP_KERNEL)) == 0) |
357 | return -ENOMEM; | 357 | return -ENOMEM; |
358 | memset ((void *) pb->priv_space, 0, size); | ||
359 | pb->overlay_last1 = pb->ch1_cmd = (volatile struct dbdma_cmd *) | 358 | pb->overlay_last1 = pb->ch1_cmd = (volatile struct dbdma_cmd *) |
360 | DBDMA_ALIGN (pb->priv_space); | 359 | DBDMA_ALIGN (pb->priv_space); |
361 | pb->overlay_last2 = pb->ch2_cmd = pb->ch1_cmd + pb->tab_size; | 360 | pb->overlay_last2 = pb->ch2_cmd = pb->ch1_cmd + pb->tab_size; |
diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c index 2d9c0dd3b733..ff555129c82f 100644 --- a/drivers/media/video/usbvideo/vicam.c +++ b/drivers/media/video/usbvideo/vicam.c | |||
@@ -1130,13 +1130,12 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id) | |||
1130 | } | 1130 | } |
1131 | 1131 | ||
1132 | if ((cam = | 1132 | if ((cam = |
1133 | kmalloc(sizeof (struct vicam_camera), GFP_KERNEL)) == NULL) { | 1133 | kzalloc(sizeof (struct vicam_camera), GFP_KERNEL)) == NULL) { |
1134 | printk(KERN_WARNING | 1134 | printk(KERN_WARNING |
1135 | "could not allocate kernel memory for vicam_camera struct\n"); | 1135 | "could not allocate kernel memory for vicam_camera struct\n"); |
1136 | return -ENOMEM; | 1136 | return -ENOMEM; |
1137 | } | 1137 | } |
1138 | 1138 | ||
1139 | memset(cam, 0, sizeof (struct vicam_camera)); | ||
1140 | 1139 | ||
1141 | cam->shutter_speed = 15; | 1140 | cam->shutter_speed = 15; |
1142 | 1141 | ||
diff --git a/drivers/mfd/mcp-core.c b/drivers/mfd/mcp-core.c index 75f401d52fda..b4ed57e02729 100644 --- a/drivers/mfd/mcp-core.c +++ b/drivers/mfd/mcp-core.c | |||
@@ -200,9 +200,8 @@ struct mcp *mcp_host_alloc(struct device *parent, size_t size) | |||
200 | { | 200 | { |
201 | struct mcp *mcp; | 201 | struct mcp *mcp; |
202 | 202 | ||
203 | mcp = kmalloc(sizeof(struct mcp) + size, GFP_KERNEL); | 203 | mcp = kzalloc(sizeof(struct mcp) + size, GFP_KERNEL); |
204 | if (mcp) { | 204 | if (mcp) { |
205 | memset(mcp, 0, sizeof(struct mcp) + size); | ||
206 | spin_lock_init(&mcp->lock); | 205 | spin_lock_init(&mcp->lock); |
207 | mcp->attached_device.parent = parent; | 206 | mcp->attached_device.parent = parent; |
208 | mcp->attached_device.bus = &mcp_bus_type; | 207 | mcp->attached_device.bus = &mcp_bus_type; |
diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c index 149810a084f5..e03f1bcd4f9f 100644 --- a/drivers/mfd/ucb1x00-core.c +++ b/drivers/mfd/ucb1x00-core.c | |||
@@ -484,12 +484,11 @@ static int ucb1x00_probe(struct mcp *mcp) | |||
484 | goto err_disable; | 484 | goto err_disable; |
485 | } | 485 | } |
486 | 486 | ||
487 | ucb = kmalloc(sizeof(struct ucb1x00), GFP_KERNEL); | 487 | ucb = kzalloc(sizeof(struct ucb1x00), GFP_KERNEL); |
488 | ret = -ENOMEM; | 488 | ret = -ENOMEM; |
489 | if (!ucb) | 489 | if (!ucb) |
490 | goto err_disable; | 490 | goto err_disable; |
491 | 491 | ||
492 | memset(ucb, 0, sizeof(struct ucb1x00)); | ||
493 | 492 | ||
494 | ucb->cdev.class = &ucb1x00_class; | 493 | ucb->cdev.class = &ucb1x00_class; |
495 | ucb->cdev.dev = &mcp->attached_device; | 494 | ucb->cdev.dev = &mcp->attached_device; |
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c index 7798f590e5aa..f75306059971 100644 --- a/drivers/misc/asus-laptop.c +++ b/drivers/misc/asus-laptop.c | |||
@@ -979,10 +979,9 @@ static int asus_hotk_add(struct acpi_device *device) | |||
979 | printk(ASUS_NOTICE "Asus Laptop Support version %s\n", | 979 | printk(ASUS_NOTICE "Asus Laptop Support version %s\n", |
980 | ASUS_LAPTOP_VERSION); | 980 | ASUS_LAPTOP_VERSION); |
981 | 981 | ||
982 | hotk = kmalloc(sizeof(struct asus_hotk), GFP_KERNEL); | 982 | hotk = kzalloc(sizeof(struct asus_hotk), GFP_KERNEL); |
983 | if (!hotk) | 983 | if (!hotk) |
984 | return -ENOMEM; | 984 | return -ENOMEM; |
985 | memset(hotk, 0, sizeof(struct asus_hotk)); | ||
986 | 985 | ||
987 | hotk->handle = device->handle; | 986 | hotk->handle = device->handle; |
988 | strcpy(acpi_device_name(device), ASUS_HOTK_DEVICE_NAME); | 987 | strcpy(acpi_device_name(device), ASUS_HOTK_DEVICE_NAME); |
diff --git a/drivers/misc/ibmasm/command.c b/drivers/misc/ibmasm/command.c index b5df347c81b9..6497872df524 100644 --- a/drivers/misc/ibmasm/command.c +++ b/drivers/misc/ibmasm/command.c | |||
@@ -41,18 +41,16 @@ struct command *ibmasm_new_command(struct service_processor *sp, size_t buffer_s | |||
41 | if (buffer_size > IBMASM_CMD_MAX_BUFFER_SIZE) | 41 | if (buffer_size > IBMASM_CMD_MAX_BUFFER_SIZE) |
42 | return NULL; | 42 | return NULL; |
43 | 43 | ||
44 | cmd = kmalloc(sizeof(struct command), GFP_KERNEL); | 44 | cmd = kzalloc(sizeof(struct command), GFP_KERNEL); |
45 | if (cmd == NULL) | 45 | if (cmd == NULL) |
46 | return NULL; | 46 | return NULL; |
47 | 47 | ||
48 | memset(cmd, 0, sizeof(*cmd)); | ||
49 | 48 | ||
50 | cmd->buffer = kmalloc(buffer_size, GFP_KERNEL); | 49 | cmd->buffer = kzalloc(buffer_size, GFP_KERNEL); |
51 | if (cmd->buffer == NULL) { | 50 | if (cmd->buffer == NULL) { |
52 | kfree(cmd); | 51 | kfree(cmd); |
53 | return NULL; | 52 | return NULL; |
54 | } | 53 | } |
55 | memset(cmd->buffer, 0, buffer_size); | ||
56 | cmd->buffer_size = buffer_size; | 54 | cmd->buffer_size = buffer_size; |
57 | 55 | ||
58 | kobject_init(&cmd->kobj); | 56 | kobject_init(&cmd->kobj); |
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c index eb7b073734b8..22a7e8ba211d 100644 --- a/drivers/misc/ibmasm/ibmasmfs.c +++ b/drivers/misc/ibmasm/ibmasmfs.c | |||
@@ -563,11 +563,10 @@ static ssize_t remote_settings_file_write(struct file *file, const char __user * | |||
563 | if (*offset != 0) | 563 | if (*offset != 0) |
564 | return 0; | 564 | return 0; |
565 | 565 | ||
566 | buff = kmalloc (count + 1, GFP_KERNEL); | 566 | buff = kzalloc (count + 1, GFP_KERNEL); |
567 | if (!buff) | 567 | if (!buff) |
568 | return -ENOMEM; | 568 | return -ENOMEM; |
569 | 569 | ||
570 | memset(buff, 0x0, count + 1); | ||
571 | 570 | ||
572 | if (copy_from_user(buff, ubuff, count)) { | 571 | if (copy_from_user(buff, ubuff, count)) { |
573 | kfree(buff); | 572 | kfree(buff); |
diff --git a/drivers/misc/ibmasm/module.c b/drivers/misc/ibmasm/module.c index fb03a853fac4..4f9d4a9da983 100644 --- a/drivers/misc/ibmasm/module.c +++ b/drivers/misc/ibmasm/module.c | |||
@@ -77,13 +77,12 @@ static int __devinit ibmasm_init_one(struct pci_dev *pdev, const struct pci_devi | |||
77 | /* vnc client won't work without bus-mastering */ | 77 | /* vnc client won't work without bus-mastering */ |
78 | pci_set_master(pdev); | 78 | pci_set_master(pdev); |
79 | 79 | ||
80 | sp = kmalloc(sizeof(struct service_processor), GFP_KERNEL); | 80 | sp = kzalloc(sizeof(struct service_processor), GFP_KERNEL); |
81 | if (sp == NULL) { | 81 | if (sp == NULL) { |
82 | dev_err(&pdev->dev, "Failed to allocate memory\n"); | 82 | dev_err(&pdev->dev, "Failed to allocate memory\n"); |
83 | result = -ENOMEM; | 83 | result = -ENOMEM; |
84 | goto error_kmalloc; | 84 | goto error_kmalloc; |
85 | } | 85 | } |
86 | memset(sp, 0, sizeof(struct service_processor)); | ||
87 | 86 | ||
88 | spin_lock_init(&sp->lock); | 87 | spin_lock_init(&sp->lock); |
89 | INIT_LIST_HEAD(&sp->command_queue); | 88 | INIT_LIST_HEAD(&sp->command_queue); |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index cbd4b6e3e17c..93fe2e5dd616 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -414,13 +414,12 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card) | |||
414 | return ERR_PTR(-ENOSPC); | 414 | return ERR_PTR(-ENOSPC); |
415 | __set_bit(devidx, dev_use); | 415 | __set_bit(devidx, dev_use); |
416 | 416 | ||
417 | md = kmalloc(sizeof(struct mmc_blk_data), GFP_KERNEL); | 417 | md = kzalloc(sizeof(struct mmc_blk_data), GFP_KERNEL); |
418 | if (!md) { | 418 | if (!md) { |
419 | ret = -ENOMEM; | 419 | ret = -ENOMEM; |
420 | goto out; | 420 | goto out; |
421 | } | 421 | } |
422 | 422 | ||
423 | memset(md, 0, sizeof(struct mmc_blk_data)); | ||
424 | 423 | ||
425 | /* | 424 | /* |
426 | * Set the read-only status based on the supported commands | 425 | * Set the read-only status based on the supported commands |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index 96fb0ec905a7..37f1b6ff5c12 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -1519,14 +1519,13 @@ static void b44_setup_pseudo_magicp(struct b44 *bp) | |||
1519 | u8 *pwol_pattern; | 1519 | u8 *pwol_pattern; |
1520 | u8 pwol_mask[B44_PMASK_SIZE]; | 1520 | u8 pwol_mask[B44_PMASK_SIZE]; |
1521 | 1521 | ||
1522 | pwol_pattern = kmalloc(B44_PATTERN_SIZE, GFP_KERNEL); | 1522 | pwol_pattern = kzalloc(B44_PATTERN_SIZE, GFP_KERNEL); |
1523 | if (!pwol_pattern) { | 1523 | if (!pwol_pattern) { |
1524 | printk(KERN_ERR PFX "Memory not available for WOL\n"); | 1524 | printk(KERN_ERR PFX "Memory not available for WOL\n"); |
1525 | return; | 1525 | return; |
1526 | } | 1526 | } |
1527 | 1527 | ||
1528 | /* Ipv4 magic packet pattern - pattern 0.*/ | 1528 | /* Ipv4 magic packet pattern - pattern 0.*/ |
1529 | memset(pwol_pattern, 0, B44_PATTERN_SIZE); | ||
1530 | memset(pwol_mask, 0, B44_PMASK_SIZE); | 1529 | memset(pwol_mask, 0, B44_PMASK_SIZE); |
1531 | plen0 = b44_magic_pattern(bp->dev->dev_addr, pwol_pattern, pwol_mask, | 1530 | plen0 = b44_magic_pattern(bp->dev->dev_addr, pwol_pattern, pwol_mask, |
1532 | B44_ETHIPV4UDP_HLEN); | 1531 | B44_ETHIPV4UDP_HLEN); |
diff --git a/drivers/net/bsd_comp.c b/drivers/net/bsd_comp.c index 7845eaf6f29f..202d4a4ef751 100644 --- a/drivers/net/bsd_comp.c +++ b/drivers/net/bsd_comp.c | |||
@@ -395,14 +395,13 @@ static void *bsd_alloc (unsigned char *options, int opt_len, int decomp) | |||
395 | * Allocate the main control structure for this instance. | 395 | * Allocate the main control structure for this instance. |
396 | */ | 396 | */ |
397 | maxmaxcode = MAXCODE(bits); | 397 | maxmaxcode = MAXCODE(bits); |
398 | db = kmalloc(sizeof (struct bsd_db), | 398 | db = kzalloc(sizeof (struct bsd_db), |
399 | GFP_KERNEL); | 399 | GFP_KERNEL); |
400 | if (!db) | 400 | if (!db) |
401 | { | 401 | { |
402 | return NULL; | 402 | return NULL; |
403 | } | 403 | } |
404 | 404 | ||
405 | memset (db, 0, sizeof(struct bsd_db)); | ||
406 | /* | 405 | /* |
407 | * Allocate space for the dictionary. This may be more than one page in | 406 | * Allocate space for the dictionary. This may be more than one page in |
408 | * length. | 407 | * length. |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 136827f8dc2e..6d1d50a19783 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -5137,12 +5137,10 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
5137 | goto out_unmap; | 5137 | goto out_unmap; |
5138 | np->tx_ring.ex = &np->rx_ring.ex[np->rx_ring_size]; | 5138 | np->tx_ring.ex = &np->rx_ring.ex[np->rx_ring_size]; |
5139 | } | 5139 | } |
5140 | np->rx_skb = kmalloc(sizeof(struct nv_skb_map) * np->rx_ring_size, GFP_KERNEL); | 5140 | np->rx_skb = kcalloc(np->rx_ring_size, sizeof(struct nv_skb_map), GFP_KERNEL); |
5141 | np->tx_skb = kmalloc(sizeof(struct nv_skb_map) * np->tx_ring_size, GFP_KERNEL); | 5141 | np->tx_skb = kcalloc(np->tx_ring_size, sizeof(struct nv_skb_map), GFP_KERNEL); |
5142 | if (!np->rx_skb || !np->tx_skb) | 5142 | if (!np->rx_skb || !np->tx_skb) |
5143 | goto out_freering; | 5143 | goto out_freering; |
5144 | memset(np->rx_skb, 0, sizeof(struct nv_skb_map) * np->rx_ring_size); | ||
5145 | memset(np->tx_skb, 0, sizeof(struct nv_skb_map) * np->tx_ring_size); | ||
5146 | 5144 | ||
5147 | dev->open = nv_open; | 5145 | dev->open = nv_open; |
5148 | dev->stop = nv_close; | 5146 | dev->stop = nv_close; |
diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c index 3be8c5047599..205f09672492 100644 --- a/drivers/net/hamradio/dmascc.c +++ b/drivers/net/hamradio/dmascc.c | |||
@@ -453,8 +453,8 @@ static int __init setup_adapter(int card_base, int type, int n) | |||
453 | int scc_base = card_base + hw[type].scc_offset; | 453 | int scc_base = card_base + hw[type].scc_offset; |
454 | char *chipnames[] = CHIPNAMES; | 454 | char *chipnames[] = CHIPNAMES; |
455 | 455 | ||
456 | /* Allocate memory */ | 456 | /* Initialize what is necessary for write_scc and write_scc_data */ |
457 | info = kmalloc(sizeof(struct scc_info), GFP_KERNEL | GFP_DMA); | 457 | info = kzalloc(sizeof(struct scc_info), GFP_KERNEL | GFP_DMA); |
458 | if (!info) { | 458 | if (!info) { |
459 | printk(KERN_ERR "dmascc: " | 459 | printk(KERN_ERR "dmascc: " |
460 | "could not allocate memory for %s at %#3x\n", | 460 | "could not allocate memory for %s at %#3x\n", |
@@ -462,8 +462,6 @@ static int __init setup_adapter(int card_base, int type, int n) | |||
462 | goto out; | 462 | goto out; |
463 | } | 463 | } |
464 | 464 | ||
465 | /* Initialize what is necessary for write_scc and write_scc_data */ | ||
466 | memset(info, 0, sizeof(struct scc_info)); | ||
467 | 465 | ||
468 | info->dev[0] = alloc_netdev(0, "", dev_setup); | 466 | info->dev[0] = alloc_netdev(0, "", dev_setup); |
469 | if (!info->dev[0]) { | 467 | if (!info->dev[0]) { |
diff --git a/drivers/net/irda/irport.c b/drivers/net/irda/irport.c index 3078c419cb02..20732458f5ac 100644 --- a/drivers/net/irda/irport.c +++ b/drivers/net/irda/irport.c | |||
@@ -164,14 +164,13 @@ irport_open(int i, unsigned int iobase, unsigned int irq) | |||
164 | 164 | ||
165 | /* Allocate memory if needed */ | 165 | /* Allocate memory if needed */ |
166 | if (self->tx_buff.truesize > 0) { | 166 | if (self->tx_buff.truesize > 0) { |
167 | self->tx_buff.head = kmalloc(self->tx_buff.truesize, | 167 | self->tx_buff.head = kzalloc(self->tx_buff.truesize, |
168 | GFP_KERNEL); | 168 | GFP_KERNEL); |
169 | if (self->tx_buff.head == NULL) { | 169 | if (self->tx_buff.head == NULL) { |
170 | IRDA_ERROR("%s(), can't allocate memory for " | 170 | IRDA_ERROR("%s(), can't allocate memory for " |
171 | "transmit buffer!\n", __FUNCTION__); | 171 | "transmit buffer!\n", __FUNCTION__); |
172 | goto err_out4; | 172 | goto err_out4; |
173 | } | 173 | } |
174 | memset(self->tx_buff.head, 0, self->tx_buff.truesize); | ||
175 | } | 174 | } |
176 | self->tx_buff.data = self->tx_buff.head; | 175 | self->tx_buff.data = self->tx_buff.head; |
177 | 176 | ||
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c index ad1857364d51..6f5f697ec9f8 100644 --- a/drivers/net/irda/irtty-sir.c +++ b/drivers/net/irda/irtty-sir.c | |||
@@ -505,10 +505,9 @@ static int irtty_open(struct tty_struct *tty) | |||
505 | } | 505 | } |
506 | 506 | ||
507 | /* allocate private device info block */ | 507 | /* allocate private device info block */ |
508 | priv = kmalloc(sizeof(*priv), GFP_KERNEL); | 508 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
509 | if (!priv) | 509 | if (!priv) |
510 | goto out_put; | 510 | goto out_put; |
511 | memset(priv, 0, sizeof(*priv)); | ||
512 | 511 | ||
513 | priv->magic = IRTTY_MAGIC; | 512 | priv->magic = IRTTY_MAGIC; |
514 | priv->tty = tty; | 513 | priv->tty = tty; |
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index 347d50cd77d4..0433c41f9029 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c | |||
@@ -822,10 +822,9 @@ static int veth_init_connection(u8 rlp) | |||
822 | || ! HvLpConfig_doLpsCommunicateOnVirtualLan(this_lp, rlp) ) | 822 | || ! HvLpConfig_doLpsCommunicateOnVirtualLan(this_lp, rlp) ) |
823 | return 0; | 823 | return 0; |
824 | 824 | ||
825 | cnx = kmalloc(sizeof(*cnx), GFP_KERNEL); | 825 | cnx = kzalloc(sizeof(*cnx), GFP_KERNEL); |
826 | if (! cnx) | 826 | if (! cnx) |
827 | return -ENOMEM; | 827 | return -ENOMEM; |
828 | memset(cnx, 0, sizeof(*cnx)); | ||
829 | 828 | ||
830 | cnx->remote_lp = rlp; | 829 | cnx->remote_lp = rlp; |
831 | spin_lock_init(&cnx->lock); | 830 | spin_lock_init(&cnx->lock); |
@@ -852,14 +851,13 @@ static int veth_init_connection(u8 rlp) | |||
852 | if (rc != 0) | 851 | if (rc != 0) |
853 | return rc; | 852 | return rc; |
854 | 853 | ||
855 | msgs = kmalloc(VETH_NUMBUFFERS * sizeof(struct veth_msg), GFP_KERNEL); | 854 | msgs = kcalloc(VETH_NUMBUFFERS, sizeof(struct veth_msg), GFP_KERNEL); |
856 | if (! msgs) { | 855 | if (! msgs) { |
857 | veth_error("Can't allocate buffers for LPAR %d.\n", rlp); | 856 | veth_error("Can't allocate buffers for LPAR %d.\n", rlp); |
858 | return -ENOMEM; | 857 | return -ENOMEM; |
859 | } | 858 | } |
860 | 859 | ||
861 | cnx->msgs = msgs; | 860 | cnx->msgs = msgs; |
862 | memset(msgs, 0, VETH_NUMBUFFERS * sizeof(struct veth_msg)); | ||
863 | 861 | ||
864 | for (i = 0; i < VETH_NUMBUFFERS; i++) { | 862 | for (i = 0; i < VETH_NUMBUFFERS; i++) { |
865 | msgs[i].token = i; | 863 | msgs[i].token = i; |
diff --git a/drivers/net/lance.c b/drivers/net/lance.c index a2f37e52b928..a4e5fab12628 100644 --- a/drivers/net/lance.c +++ b/drivers/net/lance.c | |||
@@ -533,11 +533,10 @@ static int __init lance_probe1(struct net_device *dev, int ioaddr, int irq, int | |||
533 | dev->base_addr = ioaddr; | 533 | dev->base_addr = ioaddr; |
534 | /* Make certain the data structures used by the LANCE are aligned and DMAble. */ | 534 | /* Make certain the data structures used by the LANCE are aligned and DMAble. */ |
535 | 535 | ||
536 | lp = kmalloc(sizeof(*lp), GFP_DMA | GFP_KERNEL); | 536 | lp = kzalloc(sizeof(*lp), GFP_DMA | GFP_KERNEL); |
537 | if(lp==NULL) | 537 | if(lp==NULL) |
538 | return -ENODEV; | 538 | return -ENODEV; |
539 | if (lance_debug > 6) printk(" (#0x%05lx)", (unsigned long)lp); | 539 | if (lance_debug > 6) printk(" (#0x%05lx)", (unsigned long)lp); |
540 | memset(lp, 0, sizeof(*lp)); | ||
541 | dev->priv = lp; | 540 | dev->priv = lp; |
542 | lp->name = chipname; | 541 | lp->name = chipname; |
543 | lp->rx_buffs = (unsigned long)kmalloc(PKT_BUF_SZ*RX_RING_SIZE, | 542 | lp->rx_buffs = (unsigned long)kmalloc(PKT_BUF_SZ*RX_RING_SIZE, |
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index 0d1c7a41c9c6..ea9414c4d900 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c | |||
@@ -147,7 +147,7 @@ static int com20020_probe(struct pcmcia_device *p_dev) | |||
147 | DEBUG(0, "com20020_attach()\n"); | 147 | DEBUG(0, "com20020_attach()\n"); |
148 | 148 | ||
149 | /* Create new network device */ | 149 | /* Create new network device */ |
150 | info = kmalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); | 150 | info = kzalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); |
151 | if (!info) | 151 | if (!info) |
152 | goto fail_alloc_info; | 152 | goto fail_alloc_info; |
153 | 153 | ||
@@ -155,7 +155,6 @@ static int com20020_probe(struct pcmcia_device *p_dev) | |||
155 | if (!dev) | 155 | if (!dev) |
156 | goto fail_alloc_dev; | 156 | goto fail_alloc_dev; |
157 | 157 | ||
158 | memset(info, 0, sizeof(struct com20020_dev_t)); | ||
159 | lp = dev->priv; | 158 | lp = dev->priv; |
160 | lp->timeout = timeout; | 159 | lp->timeout = timeout; |
161 | lp->backplane = backplane; | 160 | lp->backplane = backplane; |
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index 4ecb8ca5a992..4eafa4f42cff 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c | |||
@@ -146,9 +146,8 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link) | |||
146 | DEBUG(0, "ibmtr_attach()\n"); | 146 | DEBUG(0, "ibmtr_attach()\n"); |
147 | 147 | ||
148 | /* Create new token-ring device */ | 148 | /* Create new token-ring device */ |
149 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 149 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
150 | if (!info) return -ENOMEM; | 150 | if (!info) return -ENOMEM; |
151 | memset(info,0,sizeof(*info)); | ||
152 | dev = alloc_trdev(sizeof(struct tok_info)); | 151 | dev = alloc_trdev(sizeof(struct tok_info)); |
153 | if (!dev) { | 152 | if (!dev) { |
154 | kfree(info); | 153 | kfree(info); |
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index caabbc408c34..27f5b904f48e 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
@@ -159,12 +159,11 @@ ppp_asynctty_open(struct tty_struct *tty) | |||
159 | int err; | 159 | int err; |
160 | 160 | ||
161 | err = -ENOMEM; | 161 | err = -ENOMEM; |
162 | ap = kmalloc(sizeof(*ap), GFP_KERNEL); | 162 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); |
163 | if (ap == 0) | 163 | if (ap == 0) |
164 | goto out; | 164 | goto out; |
165 | 165 | ||
166 | /* initialize the asyncppp structure */ | 166 | /* initialize the asyncppp structure */ |
167 | memset(ap, 0, sizeof(*ap)); | ||
168 | ap->tty = tty; | 167 | ap->tty = tty; |
169 | ap->mru = PPP_MRU; | 168 | ap->mru = PPP_MRU; |
170 | spin_lock_init(&ap->xmit_lock); | 169 | spin_lock_init(&ap->xmit_lock); |
diff --git a/drivers/net/ppp_deflate.c b/drivers/net/ppp_deflate.c index 72c8d6628f58..eb98b661efba 100644 --- a/drivers/net/ppp_deflate.c +++ b/drivers/net/ppp_deflate.c | |||
@@ -121,12 +121,11 @@ static void *z_comp_alloc(unsigned char *options, int opt_len) | |||
121 | if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE) | 121 | if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE) |
122 | return NULL; | 122 | return NULL; |
123 | 123 | ||
124 | state = kmalloc(sizeof(*state), | 124 | state = kzalloc(sizeof(*state), |
125 | GFP_KERNEL); | 125 | GFP_KERNEL); |
126 | if (state == NULL) | 126 | if (state == NULL) |
127 | return NULL; | 127 | return NULL; |
128 | 128 | ||
129 | memset (state, 0, sizeof (struct ppp_deflate_state)); | ||
130 | state->strm.next_in = NULL; | 129 | state->strm.next_in = NULL; |
131 | state->w_size = w_size; | 130 | state->w_size = w_size; |
132 | state->strm.workspace = vmalloc(zlib_deflate_workspacesize()); | 131 | state->strm.workspace = vmalloc(zlib_deflate_workspacesize()); |
@@ -341,11 +340,10 @@ static void *z_decomp_alloc(unsigned char *options, int opt_len) | |||
341 | if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE) | 340 | if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE) |
342 | return NULL; | 341 | return NULL; |
343 | 342 | ||
344 | state = kmalloc(sizeof(*state), GFP_KERNEL); | 343 | state = kzalloc(sizeof(*state), GFP_KERNEL); |
345 | if (state == NULL) | 344 | if (state == NULL) |
346 | return NULL; | 345 | return NULL; |
347 | 346 | ||
348 | memset (state, 0, sizeof (struct ppp_deflate_state)); | ||
349 | state->w_size = w_size; | 347 | state->w_size = w_size; |
350 | state->strm.next_out = NULL; | 348 | state->strm.next_out = NULL; |
351 | state->strm.workspace = kmalloc(zlib_inflate_workspacesize(), | 349 | state->strm.workspace = kmalloc(zlib_inflate_workspacesize(), |
diff --git a/drivers/net/ppp_mppe.c b/drivers/net/ppp_mppe.c index d5bdd2574659..f79cf87a2bff 100644 --- a/drivers/net/ppp_mppe.c +++ b/drivers/net/ppp_mppe.c | |||
@@ -200,11 +200,10 @@ static void *mppe_alloc(unsigned char *options, int optlen) | |||
200 | || options[0] != CI_MPPE || options[1] != CILEN_MPPE) | 200 | || options[0] != CI_MPPE || options[1] != CILEN_MPPE) |
201 | goto out; | 201 | goto out; |
202 | 202 | ||
203 | state = kmalloc(sizeof(*state), GFP_KERNEL); | 203 | state = kzalloc(sizeof(*state), GFP_KERNEL); |
204 | if (state == NULL) | 204 | if (state == NULL) |
205 | goto out; | 205 | goto out; |
206 | 206 | ||
207 | memset(state, 0, sizeof(*state)); | ||
208 | 207 | ||
209 | state->arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); | 208 | state->arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); |
210 | if (IS_ERR(state->arc4)) { | 209 | if (IS_ERR(state->arc4)) { |
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c index 5918fab38349..ce64032a465a 100644 --- a/drivers/net/ppp_synctty.c +++ b/drivers/net/ppp_synctty.c | |||
@@ -207,13 +207,12 @@ ppp_sync_open(struct tty_struct *tty) | |||
207 | struct syncppp *ap; | 207 | struct syncppp *ap; |
208 | int err; | 208 | int err; |
209 | 209 | ||
210 | ap = kmalloc(sizeof(*ap), GFP_KERNEL); | 210 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); |
211 | err = -ENOMEM; | 211 | err = -ENOMEM; |
212 | if (ap == 0) | 212 | if (ap == 0) |
213 | goto out; | 213 | goto out; |
214 | 214 | ||
215 | /* initialize the syncppp structure */ | 215 | /* initialize the syncppp structure */ |
216 | memset(ap, 0, sizeof(*ap)); | ||
217 | ap->tty = tty; | 216 | ap->tty = tty; |
218 | ap->mru = PPP_MRU; | 217 | ap->mru = PPP_MRU; |
219 | spin_lock_init(&ap->xmit_lock); | 218 | spin_lock_init(&ap->xmit_lock); |
diff --git a/drivers/net/shaper.c b/drivers/net/shaper.c index e886e8d7cfdf..4c3d98ff4cd4 100644 --- a/drivers/net/shaper.c +++ b/drivers/net/shaper.c | |||
@@ -600,10 +600,9 @@ static int __init shaper_init(void) | |||
600 | return -ENODEV; | 600 | return -ENODEV; |
601 | 601 | ||
602 | alloc_size = sizeof(*dev) * shapers; | 602 | alloc_size = sizeof(*dev) * shapers; |
603 | devs = kmalloc(alloc_size, GFP_KERNEL); | 603 | devs = kzalloc(alloc_size, GFP_KERNEL); |
604 | if (!devs) | 604 | if (!devs) |
605 | return -ENOMEM; | 605 | return -ENOMEM; |
606 | memset(devs, 0, alloc_size); | ||
607 | 606 | ||
608 | for (i = 0; i < shapers; i++) { | 607 | for (i = 0; i < shapers; i++) { |
609 | 608 | ||
diff --git a/drivers/net/wan/c101.c b/drivers/net/wan/c101.c index 6b63b350cd52..8ead774d14c8 100644 --- a/drivers/net/wan/c101.c +++ b/drivers/net/wan/c101.c | |||
@@ -315,12 +315,11 @@ static int __init c101_run(unsigned long irq, unsigned long winbase) | |||
315 | return -ENODEV; | 315 | return -ENODEV; |
316 | } | 316 | } |
317 | 317 | ||
318 | card = kmalloc(sizeof(card_t), GFP_KERNEL); | 318 | card = kzalloc(sizeof(card_t), GFP_KERNEL); |
319 | if (card == NULL) { | 319 | if (card == NULL) { |
320 | printk(KERN_ERR "c101: unable to allocate memory\n"); | 320 | printk(KERN_ERR "c101: unable to allocate memory\n"); |
321 | return -ENOBUFS; | 321 | return -ENOBUFS; |
322 | } | 322 | } |
323 | memset(card, 0, sizeof(card_t)); | ||
324 | 323 | ||
325 | card->dev = alloc_hdlcdev(card); | 324 | card->dev = alloc_hdlcdev(card); |
326 | if (!card->dev) { | 325 | if (!card->dev) { |
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index 9ef49ce148b2..26058b4f8f36 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c | |||
@@ -572,13 +572,11 @@ static int cosa_probe(int base, int irq, int dma) | |||
572 | sprintf(cosa->name, "cosa%d", cosa->num); | 572 | sprintf(cosa->name, "cosa%d", cosa->num); |
573 | 573 | ||
574 | /* Initialize the per-channel data */ | 574 | /* Initialize the per-channel data */ |
575 | cosa->chan = kmalloc(sizeof(struct channel_data)*cosa->nchannels, | 575 | cosa->chan = kcalloc(cosa->nchannels, sizeof(struct channel_data), GFP_KERNEL); |
576 | GFP_KERNEL); | ||
577 | if (!cosa->chan) { | 576 | if (!cosa->chan) { |
578 | err = -ENOMEM; | 577 | err = -ENOMEM; |
579 | goto err_out3; | 578 | goto err_out3; |
580 | } | 579 | } |
581 | memset(cosa->chan, 0, sizeof(struct channel_data)*cosa->nchannels); | ||
582 | for (i=0; i<cosa->nchannels; i++) { | 580 | for (i=0; i<cosa->nchannels; i++) { |
583 | cosa->chan[i].cosa = cosa; | 581 | cosa->chan[i].cosa = cosa; |
584 | cosa->chan[i].num = i; | 582 | cosa->chan[i].num = i; |
diff --git a/drivers/net/wan/cycx_main.c b/drivers/net/wan/cycx_main.c index 6e5f1c898517..a0e8611ad8e8 100644 --- a/drivers/net/wan/cycx_main.c +++ b/drivers/net/wan/cycx_main.c | |||
@@ -113,12 +113,10 @@ static int __init cycx_init(void) | |||
113 | /* Verify number of cards and allocate adapter data space */ | 113 | /* Verify number of cards and allocate adapter data space */ |
114 | cycx_ncards = min_t(int, cycx_ncards, CYCX_MAX_CARDS); | 114 | cycx_ncards = min_t(int, cycx_ncards, CYCX_MAX_CARDS); |
115 | cycx_ncards = max_t(int, cycx_ncards, 1); | 115 | cycx_ncards = max_t(int, cycx_ncards, 1); |
116 | cycx_card_array = kmalloc(sizeof(struct cycx_device) * cycx_ncards, | 116 | cycx_card_array = kcalloc(cycx_ncards, sizeof(struct cycx_device), GFP_KERNEL); |
117 | GFP_KERNEL); | ||
118 | if (!cycx_card_array) | 117 | if (!cycx_card_array) |
119 | goto out; | 118 | goto out; |
120 | 119 | ||
121 | memset(cycx_card_array, 0, sizeof(struct cycx_device) * cycx_ncards); | ||
122 | 120 | ||
123 | /* Register adapters with WAN router */ | 121 | /* Register adapters with WAN router */ |
124 | for (cnt = 0; cnt < cycx_ncards; ++cnt) { | 122 | for (cnt = 0; cnt < cycx_ncards; ++cnt) { |
diff --git a/drivers/net/wan/cycx_x25.c b/drivers/net/wan/cycx_x25.c index 016b3ff3ea5e..a8af28b273d3 100644 --- a/drivers/net/wan/cycx_x25.c +++ b/drivers/net/wan/cycx_x25.c | |||
@@ -376,11 +376,10 @@ static int cycx_wan_new_if(struct wan_device *wandev, struct net_device *dev, | |||
376 | } | 376 | } |
377 | 377 | ||
378 | /* allocate and initialize private data */ | 378 | /* allocate and initialize private data */ |
379 | chan = kmalloc(sizeof(struct cycx_x25_channel), GFP_KERNEL); | 379 | chan = kzalloc(sizeof(struct cycx_x25_channel), GFP_KERNEL); |
380 | if (!chan) | 380 | if (!chan) |
381 | return -ENOMEM; | 381 | return -ENOMEM; |
382 | 382 | ||
383 | memset(chan, 0, sizeof(*chan)); | ||
384 | strcpy(chan->name, conf->name); | 383 | strcpy(chan->name, conf->name); |
385 | chan->card = card; | 384 | chan->card = card; |
386 | chan->link = conf->port; | 385 | chan->link = conf->port; |
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c index dca024471455..50d2f9108dca 100644 --- a/drivers/net/wan/dscc4.c +++ b/drivers/net/wan/dscc4.c | |||
@@ -890,12 +890,11 @@ static int dscc4_found1(struct pci_dev *pdev, void __iomem *ioaddr) | |||
890 | struct dscc4_dev_priv *root; | 890 | struct dscc4_dev_priv *root; |
891 | int i, ret = -ENOMEM; | 891 | int i, ret = -ENOMEM; |
892 | 892 | ||
893 | root = kmalloc(dev_per_card*sizeof(*root), GFP_KERNEL); | 893 | root = kcalloc(dev_per_card, sizeof(*root), GFP_KERNEL); |
894 | if (!root) { | 894 | if (!root) { |
895 | printk(KERN_ERR "%s: can't allocate data\n", DRV_NAME); | 895 | printk(KERN_ERR "%s: can't allocate data\n", DRV_NAME); |
896 | goto err_out; | 896 | goto err_out; |
897 | } | 897 | } |
898 | memset(root, 0, dev_per_card*sizeof(*root)); | ||
899 | 898 | ||
900 | for (i = 0; i < dev_per_card; i++) { | 899 | for (i = 0; i < dev_per_card; i++) { |
901 | root[i].dev = alloc_hdlcdev(root + i); | 900 | root[i].dev = alloc_hdlcdev(root + i); |
@@ -903,12 +902,11 @@ static int dscc4_found1(struct pci_dev *pdev, void __iomem *ioaddr) | |||
903 | goto err_free_dev; | 902 | goto err_free_dev; |
904 | } | 903 | } |
905 | 904 | ||
906 | ppriv = kmalloc(sizeof(*ppriv), GFP_KERNEL); | 905 | ppriv = kzalloc(sizeof(*ppriv), GFP_KERNEL); |
907 | if (!ppriv) { | 906 | if (!ppriv) { |
908 | printk(KERN_ERR "%s: can't allocate private data\n", DRV_NAME); | 907 | printk(KERN_ERR "%s: can't allocate private data\n", DRV_NAME); |
909 | goto err_free_dev; | 908 | goto err_free_dev; |
910 | } | 909 | } |
911 | memset(ppriv, 0, sizeof(struct dscc4_pci_priv)); | ||
912 | 910 | ||
913 | ppriv->root = root; | 911 | ppriv->root = root; |
914 | spin_lock_init(&ppriv->lock); | 912 | spin_lock_init(&ppriv->lock); |
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index 58a53b6d9b42..12dae8e24844 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c | |||
@@ -2476,13 +2476,12 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2476 | } | 2476 | } |
2477 | 2477 | ||
2478 | /* Allocate driver private data */ | 2478 | /* Allocate driver private data */ |
2479 | card = kmalloc(sizeof (struct fst_card_info), GFP_KERNEL); | 2479 | card = kzalloc(sizeof (struct fst_card_info), GFP_KERNEL); |
2480 | if (card == NULL) { | 2480 | if (card == NULL) { |
2481 | printk_err("FarSync card found but insufficient memory for" | 2481 | printk_err("FarSync card found but insufficient memory for" |
2482 | " driver storage\n"); | 2482 | " driver storage\n"); |
2483 | return -ENOMEM; | 2483 | return -ENOMEM; |
2484 | } | 2484 | } |
2485 | memset(card, 0, sizeof (struct fst_card_info)); | ||
2486 | 2485 | ||
2487 | /* Try to enable the device */ | 2486 | /* Try to enable the device */ |
2488 | if ((err = pci_enable_device(pdev)) != 0) { | 2487 | if ((err = pci_enable_device(pdev)) != 0) { |
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c index 9ba3e4ee6ec7..bf5f8d9b5c83 100644 --- a/drivers/net/wan/hostess_sv11.c +++ b/drivers/net/wan/hostess_sv11.c | |||
@@ -231,11 +231,10 @@ static struct sv11_device *sv11_init(int iobase, int irq) | |||
231 | return NULL; | 231 | return NULL; |
232 | } | 232 | } |
233 | 233 | ||
234 | sv = kmalloc(sizeof(struct sv11_device), GFP_KERNEL); | 234 | sv = kzalloc(sizeof(struct sv11_device), GFP_KERNEL); |
235 | if(!sv) | 235 | if(!sv) |
236 | goto fail3; | 236 | goto fail3; |
237 | 237 | ||
238 | memset(sv, 0, sizeof(*sv)); | ||
239 | sv->if_ptr=&sv->netdev; | 238 | sv->if_ptr=&sv->netdev; |
240 | 239 | ||
241 | sv->netdev.dev = alloc_netdev(0, "hdlc%d", sv11_setup); | 240 | sv->netdev.dev = alloc_netdev(0, "hdlc%d", sv11_setup); |
diff --git a/drivers/net/wan/n2.c b/drivers/net/wan/n2.c index 5c322dfb79f6..cbdf0b748bde 100644 --- a/drivers/net/wan/n2.c +++ b/drivers/net/wan/n2.c | |||
@@ -351,12 +351,11 @@ static int __init n2_run(unsigned long io, unsigned long irq, | |||
351 | return -ENODEV; | 351 | return -ENODEV; |
352 | } | 352 | } |
353 | 353 | ||
354 | card = kmalloc(sizeof(card_t), GFP_KERNEL); | 354 | card = kzalloc(sizeof(card_t), GFP_KERNEL); |
355 | if (card == NULL) { | 355 | if (card == NULL) { |
356 | printk(KERN_ERR "n2: unable to allocate memory\n"); | 356 | printk(KERN_ERR "n2: unable to allocate memory\n"); |
357 | return -ENOBUFS; | 357 | return -ENOBUFS; |
358 | } | 358 | } |
359 | memset(card, 0, sizeof(card_t)); | ||
360 | 359 | ||
361 | card->ports[0].dev = alloc_hdlcdev(&card->ports[0]); | 360 | card->ports[0].dev = alloc_hdlcdev(&card->ports[0]); |
362 | card->ports[1].dev = alloc_hdlcdev(&card->ports[1]); | 361 | card->ports[1].dev = alloc_hdlcdev(&card->ports[1]); |
diff --git a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c index 5d8c78ee2cd9..99fee2f1d019 100644 --- a/drivers/net/wan/pc300_drv.c +++ b/drivers/net/wan/pc300_drv.c | |||
@@ -3456,7 +3456,7 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3456 | if ((err = pci_enable_device(pdev)) < 0) | 3456 | if ((err = pci_enable_device(pdev)) < 0) |
3457 | return err; | 3457 | return err; |
3458 | 3458 | ||
3459 | card = kmalloc(sizeof(pc300_t), GFP_KERNEL); | 3459 | card = kzalloc(sizeof(pc300_t), GFP_KERNEL); |
3460 | if (card == NULL) { | 3460 | if (card == NULL) { |
3461 | printk("PC300 found at RAM 0x%016llx, " | 3461 | printk("PC300 found at RAM 0x%016llx, " |
3462 | "but could not allocate card structure.\n", | 3462 | "but could not allocate card structure.\n", |
@@ -3464,7 +3464,6 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3464 | err = -ENOMEM; | 3464 | err = -ENOMEM; |
3465 | goto err_disable_dev; | 3465 | goto err_disable_dev; |
3466 | } | 3466 | } |
3467 | memset(card, 0, sizeof(pc300_t)); | ||
3468 | 3467 | ||
3469 | err = -ENODEV; | 3468 | err = -ENODEV; |
3470 | 3469 | ||
diff --git a/drivers/net/wan/pc300too.c b/drivers/net/wan/pc300too.c index dfbd3b00f03b..6353cb5c658d 100644 --- a/drivers/net/wan/pc300too.c +++ b/drivers/net/wan/pc300too.c | |||
@@ -334,14 +334,13 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev, | |||
334 | return i; | 334 | return i; |
335 | } | 335 | } |
336 | 336 | ||
337 | card = kmalloc(sizeof(card_t), GFP_KERNEL); | 337 | card = kzalloc(sizeof(card_t), GFP_KERNEL); |
338 | if (card == NULL) { | 338 | if (card == NULL) { |
339 | printk(KERN_ERR "pc300: unable to allocate memory\n"); | 339 | printk(KERN_ERR "pc300: unable to allocate memory\n"); |
340 | pci_release_regions(pdev); | 340 | pci_release_regions(pdev); |
341 | pci_disable_device(pdev); | 341 | pci_disable_device(pdev); |
342 | return -ENOBUFS; | 342 | return -ENOBUFS; |
343 | } | 343 | } |
344 | memset(card, 0, sizeof(card_t)); | ||
345 | pci_set_drvdata(pdev, card); | 344 | pci_set_drvdata(pdev, card); |
346 | 345 | ||
347 | if (pdev->device == PCI_DEVICE_ID_PC300_TE_1 || | 346 | if (pdev->device == PCI_DEVICE_ID_PC300_TE_1 || |
diff --git a/drivers/net/wan/pci200syn.c b/drivers/net/wan/pci200syn.c index 7f720de2e9f0..092e51d89036 100644 --- a/drivers/net/wan/pci200syn.c +++ b/drivers/net/wan/pci200syn.c | |||
@@ -312,14 +312,13 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev, | |||
312 | return i; | 312 | return i; |
313 | } | 313 | } |
314 | 314 | ||
315 | card = kmalloc(sizeof(card_t), GFP_KERNEL); | 315 | card = kzalloc(sizeof(card_t), GFP_KERNEL); |
316 | if (card == NULL) { | 316 | if (card == NULL) { |
317 | printk(KERN_ERR "pci200syn: unable to allocate memory\n"); | 317 | printk(KERN_ERR "pci200syn: unable to allocate memory\n"); |
318 | pci_release_regions(pdev); | 318 | pci_release_regions(pdev); |
319 | pci_disable_device(pdev); | 319 | pci_disable_device(pdev); |
320 | return -ENOBUFS; | 320 | return -ENOBUFS; |
321 | } | 321 | } |
322 | memset(card, 0, sizeof(card_t)); | ||
323 | pci_set_drvdata(pdev, card); | 322 | pci_set_drvdata(pdev, card); |
324 | card->ports[0].dev = alloc_hdlcdev(&card->ports[0]); | 323 | card->ports[0].dev = alloc_hdlcdev(&card->ports[0]); |
325 | card->ports[1].dev = alloc_hdlcdev(&card->ports[1]); | 324 | card->ports[1].dev = alloc_hdlcdev(&card->ports[1]); |
diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c index 6a485f0556f4..792e588d7d61 100644 --- a/drivers/net/wan/sdla.c +++ b/drivers/net/wan/sdla.c | |||
@@ -1196,10 +1196,9 @@ static int sdla_xfer(struct net_device *dev, struct sdla_mem __user *info, int r | |||
1196 | 1196 | ||
1197 | if (read) | 1197 | if (read) |
1198 | { | 1198 | { |
1199 | temp = kmalloc(mem.len, GFP_KERNEL); | 1199 | temp = kzalloc(mem.len, GFP_KERNEL); |
1200 | if (!temp) | 1200 | if (!temp) |
1201 | return(-ENOMEM); | 1201 | return(-ENOMEM); |
1202 | memset(temp, 0, mem.len); | ||
1203 | sdla_read(dev, mem.addr, temp, mem.len); | 1202 | sdla_read(dev, mem.addr, temp, mem.len); |
1204 | if(copy_to_user(mem.data, temp, mem.len)) | 1203 | if(copy_to_user(mem.data, temp, mem.len)) |
1205 | { | 1204 | { |
diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c index 131358108c5a..11276bf3149f 100644 --- a/drivers/net/wan/sealevel.c +++ b/drivers/net/wan/sealevel.c | |||
@@ -270,11 +270,10 @@ static __init struct slvl_board *slvl_init(int iobase, int irq, | |||
270 | return NULL; | 270 | return NULL; |
271 | } | 271 | } |
272 | 272 | ||
273 | b = kmalloc(sizeof(struct slvl_board), GFP_KERNEL); | 273 | b = kzalloc(sizeof(struct slvl_board), GFP_KERNEL); |
274 | if(!b) | 274 | if(!b) |
275 | goto fail3; | 275 | goto fail3; |
276 | 276 | ||
277 | memset(b, 0, sizeof(*b)); | ||
278 | if (!(b->dev[0]= slvl_alloc(iobase, irq))) | 277 | if (!(b->dev[0]= slvl_alloc(iobase, irq))) |
279 | goto fail2; | 278 | goto fail2; |
280 | 279 | ||
diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c index c73601574334..3c78f9856380 100644 --- a/drivers/net/wan/wanxl.c +++ b/drivers/net/wan/wanxl.c | |||
@@ -599,7 +599,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, | |||
599 | } | 599 | } |
600 | 600 | ||
601 | alloc_size = sizeof(card_t) + ports * sizeof(port_t); | 601 | alloc_size = sizeof(card_t) + ports * sizeof(port_t); |
602 | card = kmalloc(alloc_size, GFP_KERNEL); | 602 | card = kzalloc(alloc_size, GFP_KERNEL); |
603 | if (card == NULL) { | 603 | if (card == NULL) { |
604 | printk(KERN_ERR "wanXL %s: unable to allocate memory\n", | 604 | printk(KERN_ERR "wanXL %s: unable to allocate memory\n", |
605 | pci_name(pdev)); | 605 | pci_name(pdev)); |
@@ -607,7 +607,6 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, | |||
607 | pci_disable_device(pdev); | 607 | pci_disable_device(pdev); |
608 | return -ENOBUFS; | 608 | return -ENOBUFS; |
609 | } | 609 | } |
610 | memset(card, 0, alloc_size); | ||
611 | 610 | ||
612 | pci_set_drvdata(pdev, card); | 611 | pci_set_drvdata(pdev, card); |
613 | card->pdev = pdev; | 612 | card->pdev = pdev; |
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c index 1c9edd97accd..c48b1cc63fd5 100644 --- a/drivers/net/wan/x25_asy.c +++ b/drivers/net/wan/x25_asy.c | |||
@@ -786,14 +786,12 @@ static int __init init_x25_asy(void) | |||
786 | printk(KERN_INFO "X.25 async: version 0.00 ALPHA " | 786 | printk(KERN_INFO "X.25 async: version 0.00 ALPHA " |
787 | "(dynamic channels, max=%d).\n", x25_asy_maxdev ); | 787 | "(dynamic channels, max=%d).\n", x25_asy_maxdev ); |
788 | 788 | ||
789 | x25_asy_devs = kmalloc(sizeof(struct net_device *)*x25_asy_maxdev, | 789 | x25_asy_devs = kcalloc(x25_asy_maxdev, sizeof(struct net_device*), GFP_KERNEL); |
790 | GFP_KERNEL); | ||
791 | if (!x25_asy_devs) { | 790 | if (!x25_asy_devs) { |
792 | printk(KERN_WARNING "X25 async: Can't allocate x25_asy_ctrls[] " | 791 | printk(KERN_WARNING "X25 async: Can't allocate x25_asy_ctrls[] " |
793 | "array! Uaargh! (-> No X.25 available)\n"); | 792 | "array! Uaargh! (-> No X.25 available)\n"); |
794 | return -ENOMEM; | 793 | return -ENOMEM; |
795 | } | 794 | } |
796 | memset(x25_asy_devs, 0, sizeof(struct net_device *)*x25_asy_maxdev); | ||
797 | 795 | ||
798 | return tty_register_ldisc(N_X25, &x25_ldisc); | 796 | return tty_register_ldisc(N_X25, &x25_ldisc); |
799 | } | 797 | } |
diff --git a/drivers/nubus/nubus.c b/drivers/nubus/nubus.c index 3a0a3a734933..e503c9c98032 100644 --- a/drivers/nubus/nubus.c +++ b/drivers/nubus/nubus.c | |||
@@ -466,9 +466,8 @@ static struct nubus_dev* __init | |||
466 | parent->base, dir.base); | 466 | parent->base, dir.base); |
467 | 467 | ||
468 | /* Actually we should probably panic if this fails */ | 468 | /* Actually we should probably panic if this fails */ |
469 | if ((dev = kmalloc(sizeof(*dev), GFP_ATOMIC)) == NULL) | 469 | if ((dev = kzalloc(sizeof(*dev), GFP_ATOMIC)) == NULL) |
470 | return NULL; | 470 | return NULL; |
471 | memset(dev, 0, sizeof(*dev)); | ||
472 | dev->resid = parent->type; | 471 | dev->resid = parent->type; |
473 | dev->directory = dir.base; | 472 | dev->directory = dir.base; |
474 | dev->board = board; | 473 | dev->board = board; |
@@ -800,9 +799,8 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) | |||
800 | nubus_rewind(&rp, FORMAT_BLOCK_SIZE, bytelanes); | 799 | nubus_rewind(&rp, FORMAT_BLOCK_SIZE, bytelanes); |
801 | 800 | ||
802 | /* Actually we should probably panic if this fails */ | 801 | /* Actually we should probably panic if this fails */ |
803 | if ((board = kmalloc(sizeof(*board), GFP_ATOMIC)) == NULL) | 802 | if ((board = kzalloc(sizeof(*board), GFP_ATOMIC)) == NULL) |
804 | return NULL; | 803 | return NULL; |
805 | memset(board, 0, sizeof(*board)); | ||
806 | board->fblock = rp; | 804 | board->fblock = rp; |
807 | 805 | ||
808 | /* Dump the format block for debugging purposes */ | 806 | /* Dump the format block for debugging purposes */ |
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index 8b7d84eca05d..802a81d47367 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c | |||
@@ -105,9 +105,8 @@ static int parport_probe(struct pcmcia_device *link) | |||
105 | DEBUG(0, "parport_attach()\n"); | 105 | DEBUG(0, "parport_attach()\n"); |
106 | 106 | ||
107 | /* Create new parport device */ | 107 | /* Create new parport device */ |
108 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 108 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
109 | if (!info) return -ENOMEM; | 109 | if (!info) return -ENOMEM; |
110 | memset(info, 0, sizeof(*info)); | ||
111 | link->priv = info; | 110 | link->priv = info; |
112 | info->p_dev = link; | 111 | info->p_dev = link; |
113 | 112 | ||
diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c index 90ea3b8b99b0..bd6ad8b38168 100644 --- a/drivers/parport/parport_serial.c +++ b/drivers/parport/parport_serial.c | |||
@@ -324,10 +324,9 @@ static int __devinit parport_serial_pci_probe (struct pci_dev *dev, | |||
324 | struct parport_serial_private *priv; | 324 | struct parport_serial_private *priv; |
325 | int err; | 325 | int err; |
326 | 326 | ||
327 | priv = kmalloc (sizeof *priv, GFP_KERNEL); | 327 | priv = kzalloc (sizeof *priv, GFP_KERNEL); |
328 | if (!priv) | 328 | if (!priv) |
329 | return -ENOMEM; | 329 | return -ENOMEM; |
330 | memset(priv, 0, sizeof(struct parport_serial_private)); | ||
331 | pci_set_drvdata (dev, priv); | 330 | pci_set_drvdata (dev, priv); |
332 | 331 | ||
333 | err = pci_enable_device (dev); | 332 | err = pci_enable_device (dev); |
diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c index 6846fb42b399..ad90a01b0dfc 100644 --- a/drivers/pci/pcie/aer/aerdrv.c +++ b/drivers/pci/pcie/aer/aerdrv.c | |||
@@ -148,11 +148,10 @@ static struct aer_rpc* aer_alloc_rpc(struct pcie_device *dev) | |||
148 | { | 148 | { |
149 | struct aer_rpc *rpc; | 149 | struct aer_rpc *rpc; |
150 | 150 | ||
151 | if (!(rpc = kmalloc(sizeof(struct aer_rpc), | 151 | if (!(rpc = kzalloc(sizeof(struct aer_rpc), |
152 | GFP_KERNEL))) | 152 | GFP_KERNEL))) |
153 | return NULL; | 153 | return NULL; |
154 | 154 | ||
155 | memset(rpc, 0, sizeof(struct aer_rpc)); | ||
156 | /* | 155 | /* |
157 | * Initialize Root lock access, e_lock, to Root Error Status Reg, | 156 | * Initialize Root lock access, e_lock, to Root Error Status Reg, |
158 | * Root Error ID Reg, and Root error producer/consumer index. | 157 | * Root Error ID Reg, and Root error producer/consumer index. |
diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c index 3e20b1cc7778..8e7b2dd38810 100644 --- a/drivers/pnp/core.c +++ b/drivers/pnp/core.c | |||
@@ -35,12 +35,11 @@ void *pnp_alloc(long size) | |||
35 | { | 35 | { |
36 | void *result; | 36 | void *result; |
37 | 37 | ||
38 | result = kmalloc(size, GFP_KERNEL); | 38 | result = kzalloc(size, GFP_KERNEL); |
39 | if (!result){ | 39 | if (!result){ |
40 | printk(KERN_ERR "pnp: Out of Memory\n"); | 40 | printk(KERN_ERR "pnp: Out of Memory\n"); |
41 | return NULL; | 41 | return NULL; |
42 | } | 42 | } |
43 | memset(result, 0, size); | ||
44 | return result; | 43 | return result; |
45 | } | 44 | } |
46 | 45 | ||
diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c index f935c1f71a58..44420723a359 100644 --- a/drivers/rapidio/rio-scan.c +++ b/drivers/rapidio/rio-scan.c | |||
@@ -297,11 +297,10 @@ static struct rio_dev *rio_setup_device(struct rio_net *net, | |||
297 | struct rio_switch *rswitch; | 297 | struct rio_switch *rswitch; |
298 | int result, rdid; | 298 | int result, rdid; |
299 | 299 | ||
300 | rdev = kmalloc(sizeof(struct rio_dev), GFP_KERNEL); | 300 | rdev = kzalloc(sizeof(struct rio_dev), GFP_KERNEL); |
301 | if (!rdev) | 301 | if (!rdev) |
302 | goto out; | 302 | goto out; |
303 | 303 | ||
304 | memset(rdev, 0, sizeof(struct rio_dev)); | ||
305 | rdev->net = net; | 304 | rdev->net = net; |
306 | rio_mport_read_config_32(port, destid, hopcount, RIO_DEV_ID_CAR, | 305 | rio_mport_read_config_32(port, destid, hopcount, RIO_DEV_ID_CAR, |
307 | &result); | 306 | &result); |
@@ -801,9 +800,8 @@ static struct rio_net __devinit *rio_alloc_net(struct rio_mport *port) | |||
801 | { | 800 | { |
802 | struct rio_net *net; | 801 | struct rio_net *net; |
803 | 802 | ||
804 | net = kmalloc(sizeof(struct rio_net), GFP_KERNEL); | 803 | net = kzalloc(sizeof(struct rio_net), GFP_KERNEL); |
805 | if (net) { | 804 | if (net) { |
806 | memset(net, 0, sizeof(struct rio_net)); | ||
807 | INIT_LIST_HEAD(&net->node); | 805 | INIT_LIST_HEAD(&net->node); |
808 | INIT_LIST_HEAD(&net->devices); | 806 | INIT_LIST_HEAD(&net->devices); |
809 | INIT_LIST_HEAD(&net->mports); | 807 | INIT_LIST_HEAD(&net->mports); |
diff --git a/drivers/s390/char/tape_34xx.c b/drivers/s390/char/tape_34xx.c index e765875e8db2..80e7a537e7d2 100644 --- a/drivers/s390/char/tape_34xx.c +++ b/drivers/s390/char/tape_34xx.c | |||
@@ -131,10 +131,9 @@ tape_34xx_schedule_work(struct tape_device *device, enum tape_op op) | |||
131 | { | 131 | { |
132 | struct tape_34xx_work *p; | 132 | struct tape_34xx_work *p; |
133 | 133 | ||
134 | if ((p = kmalloc(sizeof(*p), GFP_ATOMIC)) == NULL) | 134 | if ((p = kzalloc(sizeof(*p), GFP_ATOMIC)) == NULL) |
135 | return -ENOMEM; | 135 | return -ENOMEM; |
136 | 136 | ||
137 | memset(p, 0, sizeof(*p)); | ||
138 | INIT_WORK(&p->work, tape_34xx_work_handler); | 137 | INIT_WORK(&p->work, tape_34xx_work_handler); |
139 | 138 | ||
140 | p->device = tape_get_device_reference(device); | 139 | p->device = tape_get_device_reference(device); |
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c index 348bb7b82771..023455a0b34a 100644 --- a/drivers/s390/net/claw.c +++ b/drivers/s390/net/claw.c | |||
@@ -317,8 +317,8 @@ claw_probe(struct ccwgroup_device *cgdev) | |||
317 | CLAW_DBF_TEXT_(2,setup,"probex%d",-ENOMEM); | 317 | CLAW_DBF_TEXT_(2,setup,"probex%d",-ENOMEM); |
318 | return -ENOMEM; | 318 | return -ENOMEM; |
319 | } | 319 | } |
320 | privptr->p_mtc_envelope= kmalloc( MAX_ENVELOPE_SIZE, GFP_KERNEL); | 320 | privptr->p_mtc_envelope= kzalloc( MAX_ENVELOPE_SIZE, GFP_KERNEL); |
321 | privptr->p_env = kmalloc(sizeof(struct claw_env), GFP_KERNEL); | 321 | privptr->p_env = kzalloc(sizeof(struct claw_env), GFP_KERNEL); |
322 | if ((privptr->p_mtc_envelope==NULL) || (privptr->p_env==NULL)) { | 322 | if ((privptr->p_mtc_envelope==NULL) || (privptr->p_env==NULL)) { |
323 | probe_error(cgdev); | 323 | probe_error(cgdev); |
324 | put_device(&cgdev->dev); | 324 | put_device(&cgdev->dev); |
@@ -327,8 +327,6 @@ claw_probe(struct ccwgroup_device *cgdev) | |||
327 | CLAW_DBF_TEXT_(2,setup,"probex%d",-ENOMEM); | 327 | CLAW_DBF_TEXT_(2,setup,"probex%d",-ENOMEM); |
328 | return -ENOMEM; | 328 | return -ENOMEM; |
329 | } | 329 | } |
330 | memset(privptr->p_mtc_envelope, 0x00, MAX_ENVELOPE_SIZE); | ||
331 | memset(privptr->p_env, 0x00, sizeof(struct claw_env)); | ||
332 | memcpy(privptr->p_env->adapter_name,WS_NAME_NOT_DEF,8); | 330 | memcpy(privptr->p_env->adapter_name,WS_NAME_NOT_DEF,8); |
333 | memcpy(privptr->p_env->host_name,WS_NAME_NOT_DEF,8); | 331 | memcpy(privptr->p_env->host_name,WS_NAME_NOT_DEF,8); |
334 | memcpy(privptr->p_env->api_type,WS_NAME_NOT_DEF,8); | 332 | memcpy(privptr->p_env->api_type,WS_NAME_NOT_DEF,8); |
@@ -3924,7 +3922,7 @@ add_channel(struct ccw_device *cdev,int i,struct claw_privbk *privptr) | |||
3924 | snprintf(p_ch->id, CLAW_ID_SIZE, "cl-%s", cdev->dev.bus_id); | 3922 | snprintf(p_ch->id, CLAW_ID_SIZE, "cl-%s", cdev->dev.bus_id); |
3925 | ccw_device_get_id(cdev, &dev_id); | 3923 | ccw_device_get_id(cdev, &dev_id); |
3926 | p_ch->devno = dev_id.devno; | 3924 | p_ch->devno = dev_id.devno; |
3927 | if ((p_ch->irb = kmalloc(sizeof (struct irb),GFP_KERNEL)) == NULL) { | 3925 | if ((p_ch->irb = kzalloc(sizeof (struct irb),GFP_KERNEL)) == NULL) { |
3928 | printk(KERN_WARNING "%s Out of memory in %s for irb\n", | 3926 | printk(KERN_WARNING "%s Out of memory in %s for irb\n", |
3929 | p_ch->id,__FUNCTION__); | 3927 | p_ch->id,__FUNCTION__); |
3930 | #ifdef FUNCTRACE | 3928 | #ifdef FUNCTRACE |
@@ -3933,7 +3931,6 @@ add_channel(struct ccw_device *cdev,int i,struct claw_privbk *privptr) | |||
3933 | #endif | 3931 | #endif |
3934 | return -ENOMEM; | 3932 | return -ENOMEM; |
3935 | } | 3933 | } |
3936 | memset(p_ch->irb, 0, sizeof (struct irb)); | ||
3937 | #ifdef FUNCTRACE | 3934 | #ifdef FUNCTRACE |
3938 | printk(KERN_INFO "%s:%s Exit on line %d\n", | 3935 | printk(KERN_INFO "%s:%s Exit on line %d\n", |
3939 | cdev->dev.bus_id,__FUNCTION__,__LINE__); | 3936 | cdev->dev.bus_id,__FUNCTION__,__LINE__); |
diff --git a/drivers/sbus/char/bbc_i2c.c b/drivers/sbus/char/bbc_i2c.c index 178155bf9db6..fbadd4d761f3 100644 --- a/drivers/sbus/char/bbc_i2c.c +++ b/drivers/sbus/char/bbc_i2c.c | |||
@@ -156,10 +156,9 @@ struct bbc_i2c_client *bbc_i2c_attach(struct linux_ebus_child *echild) | |||
156 | 156 | ||
157 | if (!bp) | 157 | if (!bp) |
158 | return NULL; | 158 | return NULL; |
159 | client = kmalloc(sizeof(*client), GFP_KERNEL); | 159 | client = kzalloc(sizeof(*client), GFP_KERNEL); |
160 | if (!client) | 160 | if (!client) |
161 | return NULL; | 161 | return NULL; |
162 | memset(client, 0, sizeof(*client)); | ||
163 | client->bp = bp; | 162 | client->bp = bp; |
164 | client->echild = echild; | 163 | client->echild = echild; |
165 | client->bus = echild->resource[0].start; | 164 | client->bus = echild->resource[0].start; |
diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c index 6afc7e5df0d4..26b1d2a17ed2 100644 --- a/drivers/sbus/char/vfc_dev.c +++ b/drivers/sbus/char/vfc_dev.c | |||
@@ -656,12 +656,9 @@ static int vfc_probe(void) | |||
656 | if (!cards) | 656 | if (!cards) |
657 | return -ENODEV; | 657 | return -ENODEV; |
658 | 658 | ||
659 | vfc_dev_lst = kmalloc(sizeof(struct vfc_dev *) * | 659 | vfc_dev_lst = kcalloc(cards + 1, sizeof(struct vfc_dev*), GFP_KERNEL); |
660 | (cards+1), | ||
661 | GFP_KERNEL); | ||
662 | if (vfc_dev_lst == NULL) | 660 | if (vfc_dev_lst == NULL) |
663 | return -ENOMEM; | 661 | return -ENOMEM; |
664 | memset(vfc_dev_lst, 0, sizeof(struct vfc_dev *) * (cards + 1)); | ||
665 | vfc_dev_lst[cards] = NULL; | 662 | vfc_dev_lst[cards] = NULL; |
666 | 663 | ||
667 | ret = register_chrdev(VFC_MAJOR, vfcstr, &vfc_fops); | 664 | ret = register_chrdev(VFC_MAJOR, vfcstr, &vfc_fops); |
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index 76c09097175f..6b49f6a2524d 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c | |||
@@ -1160,13 +1160,12 @@ static int twa_initialize_device_extension(TW_Device_Extension *tw_dev) | |||
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | /* Allocate event info space */ | 1162 | /* Allocate event info space */ |
1163 | tw_dev->event_queue[0] = kmalloc(sizeof(TW_Event) * TW_Q_LENGTH, GFP_KERNEL); | 1163 | tw_dev->event_queue[0] = kcalloc(TW_Q_LENGTH, sizeof(TW_Event), GFP_KERNEL); |
1164 | if (!tw_dev->event_queue[0]) { | 1164 | if (!tw_dev->event_queue[0]) { |
1165 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0x18, "Event info memory allocation failed"); | 1165 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0x18, "Event info memory allocation failed"); |
1166 | goto out; | 1166 | goto out; |
1167 | } | 1167 | } |
1168 | 1168 | ||
1169 | memset(tw_dev->event_queue[0], 0, sizeof(TW_Event) * TW_Q_LENGTH); | ||
1170 | 1169 | ||
1171 | for (i = 0; i < TW_Q_LENGTH; i++) { | 1170 | for (i = 0; i < TW_Q_LENGTH; i++) { |
1172 | tw_dev->event_queue[i] = (TW_Event *)((unsigned char *)tw_dev->event_queue[0] + (i * sizeof(TW_Event))); | 1171 | tw_dev->event_queue[i] = (TW_Event *)((unsigned char *)tw_dev->event_queue[0] + (i * sizeof(TW_Event))); |
diff --git a/drivers/scsi/NCR53C9x.c b/drivers/scsi/NCR53C9x.c index 8b5334c56f0a..773d11dd9953 100644 --- a/drivers/scsi/NCR53C9x.c +++ b/drivers/scsi/NCR53C9x.c | |||
@@ -3606,11 +3606,10 @@ out: | |||
3606 | int esp_slave_alloc(struct scsi_device *SDptr) | 3606 | int esp_slave_alloc(struct scsi_device *SDptr) |
3607 | { | 3607 | { |
3608 | struct esp_device *esp_dev = | 3608 | struct esp_device *esp_dev = |
3609 | kmalloc(sizeof(struct esp_device), GFP_ATOMIC); | 3609 | kzalloc(sizeof(struct esp_device), GFP_ATOMIC); |
3610 | 3610 | ||
3611 | if (!esp_dev) | 3611 | if (!esp_dev) |
3612 | return -ENOMEM; | 3612 | return -ENOMEM; |
3613 | memset(esp_dev, 0, sizeof(struct esp_device)); | ||
3614 | SDptr->hostdata = esp_dev; | 3613 | SDptr->hostdata = esp_dev; |
3615 | return 0; | 3614 | return 0; |
3616 | } | 3615 | } |
diff --git a/drivers/scsi/NCR_D700.c b/drivers/scsi/NCR_D700.c index f12864abed2f..3a8089705feb 100644 --- a/drivers/scsi/NCR_D700.c +++ b/drivers/scsi/NCR_D700.c | |||
@@ -181,13 +181,12 @@ NCR_D700_probe_one(struct NCR_D700_private *p, int siop, int irq, | |||
181 | struct Scsi_Host *host; | 181 | struct Scsi_Host *host; |
182 | int ret; | 182 | int ret; |
183 | 183 | ||
184 | hostdata = kmalloc(sizeof(*hostdata), GFP_KERNEL); | 184 | hostdata = kzalloc(sizeof(*hostdata), GFP_KERNEL); |
185 | if (!hostdata) { | 185 | if (!hostdata) { |
186 | printk(KERN_ERR "NCR D700: SIOP%d: Failed to allocate host" | 186 | printk(KERN_ERR "NCR D700: SIOP%d: Failed to allocate host" |
187 | "data, detatching\n", siop); | 187 | "data, detatching\n", siop); |
188 | return -ENOMEM; | 188 | return -ENOMEM; |
189 | } | 189 | } |
190 | memset(hostdata, 0, sizeof(*hostdata)); | ||
191 | 190 | ||
192 | if (!request_region(region, 64, "NCR_D700")) { | 191 | if (!request_region(region, 64, "NCR_D700")) { |
193 | printk(KERN_ERR "NCR D700: Failed to reserve IO region 0x%x\n", | 192 | printk(KERN_ERR "NCR D700: Failed to reserve IO region 0x%x\n", |
diff --git a/drivers/scsi/NCR_Q720.c b/drivers/scsi/NCR_Q720.c index 778844c3544a..a8bbdc2273b8 100644 --- a/drivers/scsi/NCR_Q720.c +++ b/drivers/scsi/NCR_Q720.c | |||
@@ -148,11 +148,10 @@ NCR_Q720_probe(struct device *dev) | |||
148 | __u32 base_addr, mem_size; | 148 | __u32 base_addr, mem_size; |
149 | void __iomem *mem_base; | 149 | void __iomem *mem_base; |
150 | 150 | ||
151 | p = kmalloc(sizeof(*p), GFP_KERNEL); | 151 | p = kzalloc(sizeof(*p), GFP_KERNEL); |
152 | if (!p) | 152 | if (!p) |
153 | return -ENOMEM; | 153 | return -ENOMEM; |
154 | 154 | ||
155 | memset(p, 0, sizeof(*p)); | ||
156 | pos2 = mca_device_read_pos(mca_dev, 2); | 155 | pos2 = mca_device_read_pos(mca_dev, 2); |
157 | /* enable device */ | 156 | /* enable device */ |
158 | pos2 |= NCR_Q720_POS2_BOARD_ENABLE | NCR_Q720_POS2_INTERRUPT_ENABLE; | 157 | pos2 |= NCR_Q720_POS2_BOARD_ENABLE | NCR_Q720_POS2_INTERRUPT_ENABLE; |
diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c index 0464c182c577..005d2b05f32d 100644 --- a/drivers/scsi/imm.c +++ b/drivers/scsi/imm.c | |||
@@ -1159,11 +1159,10 @@ static int __imm_attach(struct parport *pb) | |||
1159 | 1159 | ||
1160 | init_waitqueue_head(&waiting); | 1160 | init_waitqueue_head(&waiting); |
1161 | 1161 | ||
1162 | dev = kmalloc(sizeof(imm_struct), GFP_KERNEL); | 1162 | dev = kzalloc(sizeof(imm_struct), GFP_KERNEL); |
1163 | if (!dev) | 1163 | if (!dev) |
1164 | return -ENOMEM; | 1164 | return -ENOMEM; |
1165 | 1165 | ||
1166 | memset(dev, 0, sizeof(imm_struct)); | ||
1167 | 1166 | ||
1168 | dev->base = -1; | 1167 | dev->base = -1; |
1169 | dev->mode = IMM_AUTODETECT; | 1168 | dev->mode = IMM_AUTODETECT; |
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index 9f8ed6b81576..492a51bd6aa8 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c | |||
@@ -7068,14 +7068,13 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr) | |||
7068 | subdevice_id = pci_dev->subsystem_device; | 7068 | subdevice_id = pci_dev->subsystem_device; |
7069 | 7069 | ||
7070 | /* found a controller */ | 7070 | /* found a controller */ |
7071 | ha = kmalloc(sizeof (ips_ha_t), GFP_KERNEL); | 7071 | ha = kzalloc(sizeof (ips_ha_t), GFP_KERNEL); |
7072 | if (ha == NULL) { | 7072 | if (ha == NULL) { |
7073 | IPS_PRINTK(KERN_WARNING, pci_dev, | 7073 | IPS_PRINTK(KERN_WARNING, pci_dev, |
7074 | "Unable to allocate temporary ha struct\n"); | 7074 | "Unable to allocate temporary ha struct\n"); |
7075 | return -1; | 7075 | return -1; |
7076 | } | 7076 | } |
7077 | 7077 | ||
7078 | memset(ha, 0, sizeof (ips_ha_t)); | ||
7079 | 7078 | ||
7080 | ips_sh[index] = NULL; | 7079 | ips_sh[index] = NULL; |
7081 | ips_ha[index] = ha; | 7080 | ips_ha[index] = ha; |
diff --git a/drivers/scsi/lasi700.c b/drivers/scsi/lasi700.c index 5c32a69e41ba..3126824da36d 100644 --- a/drivers/scsi/lasi700.c +++ b/drivers/scsi/lasi700.c | |||
@@ -101,13 +101,12 @@ lasi700_probe(struct parisc_device *dev) | |||
101 | struct NCR_700_Host_Parameters *hostdata; | 101 | struct NCR_700_Host_Parameters *hostdata; |
102 | struct Scsi_Host *host; | 102 | struct Scsi_Host *host; |
103 | 103 | ||
104 | hostdata = kmalloc(sizeof(*hostdata), GFP_KERNEL); | 104 | hostdata = kzalloc(sizeof(*hostdata), GFP_KERNEL); |
105 | if (!hostdata) { | 105 | if (!hostdata) { |
106 | printk(KERN_ERR "%s: Failed to allocate host data\n", | 106 | printk(KERN_ERR "%s: Failed to allocate host data\n", |
107 | dev->dev.bus_id); | 107 | dev->dev.bus_id); |
108 | return -ENOMEM; | 108 | return -ENOMEM; |
109 | } | 109 | } |
110 | memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters)); | ||
111 | 110 | ||
112 | hostdata->dev = &dev->dev; | 111 | hostdata->dev = &dev->dev; |
113 | dma_set_mask(&dev->dev, DMA_32BIT_MASK); | 112 | dma_set_mask(&dev->dev, DMA_32BIT_MASK); |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index f81f85ee190f..07bd0dcdf0d6 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -1830,7 +1830,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1830 | /* Initialize and populate the iocb list per host. */ | 1830 | /* Initialize and populate the iocb list per host. */ |
1831 | INIT_LIST_HEAD(&phba->lpfc_iocb_list); | 1831 | INIT_LIST_HEAD(&phba->lpfc_iocb_list); |
1832 | for (i = 0; i < LPFC_IOCB_LIST_CNT; i++) { | 1832 | for (i = 0; i < LPFC_IOCB_LIST_CNT; i++) { |
1833 | iocbq_entry = kmalloc(sizeof(struct lpfc_iocbq), GFP_KERNEL); | 1833 | iocbq_entry = kzalloc(sizeof(struct lpfc_iocbq), GFP_KERNEL); |
1834 | if (iocbq_entry == NULL) { | 1834 | if (iocbq_entry == NULL) { |
1835 | printk(KERN_ERR "%s: only allocated %d iocbs of " | 1835 | printk(KERN_ERR "%s: only allocated %d iocbs of " |
1836 | "expected %d count. Unloading driver.\n", | 1836 | "expected %d count. Unloading driver.\n", |
@@ -1839,7 +1839,6 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1839 | goto out_free_iocbq; | 1839 | goto out_free_iocbq; |
1840 | } | 1840 | } |
1841 | 1841 | ||
1842 | memset(iocbq_entry, 0, sizeof(struct lpfc_iocbq)); | ||
1843 | iotag = lpfc_sli_next_iotag(phba, iocbq_entry); | 1842 | iotag = lpfc_sli_next_iotag(phba, iocbq_entry); |
1844 | if (iotag == 0) { | 1843 | if (iotag == 0) { |
1845 | kfree (iocbq_entry); | 1844 | kfree (iocbq_entry); |
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index c46685a03a9f..c6a53dccc16a 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c | |||
@@ -454,7 +454,7 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
454 | pci_set_master(pdev); | 454 | pci_set_master(pdev); |
455 | 455 | ||
456 | // Allocate the per driver initialization structure | 456 | // Allocate the per driver initialization structure |
457 | adapter = kmalloc(sizeof(adapter_t), GFP_KERNEL); | 457 | adapter = kzalloc(sizeof(adapter_t), GFP_KERNEL); |
458 | 458 | ||
459 | if (adapter == NULL) { | 459 | if (adapter == NULL) { |
460 | con_log(CL_ANN, (KERN_WARNING | 460 | con_log(CL_ANN, (KERN_WARNING |
@@ -462,7 +462,6 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
462 | 462 | ||
463 | goto out_probe_one; | 463 | goto out_probe_one; |
464 | } | 464 | } |
465 | memset(adapter, 0, sizeof(adapter_t)); | ||
466 | 465 | ||
467 | 466 | ||
468 | // set up PCI related soft state and other pre-known parameters | 467 | // set up PCI related soft state and other pre-known parameters |
@@ -746,10 +745,9 @@ megaraid_init_mbox(adapter_t *adapter) | |||
746 | * Allocate and initialize the init data structure for mailbox | 745 | * Allocate and initialize the init data structure for mailbox |
747 | * controllers | 746 | * controllers |
748 | */ | 747 | */ |
749 | raid_dev = kmalloc(sizeof(mraid_device_t), GFP_KERNEL); | 748 | raid_dev = kzalloc(sizeof(mraid_device_t), GFP_KERNEL); |
750 | if (raid_dev == NULL) return -1; | 749 | if (raid_dev == NULL) return -1; |
751 | 750 | ||
752 | memset(raid_dev, 0, sizeof(mraid_device_t)); | ||
753 | 751 | ||
754 | /* | 752 | /* |
755 | * Attach the adapter soft state to raid device soft state | 753 | * Attach the adapter soft state to raid device soft state |
@@ -1050,8 +1048,7 @@ megaraid_alloc_cmd_packets(adapter_t *adapter) | |||
1050 | * since the calling routine does not yet know the number of available | 1048 | * since the calling routine does not yet know the number of available |
1051 | * commands. | 1049 | * commands. |
1052 | */ | 1050 | */ |
1053 | adapter->kscb_list = kmalloc(sizeof(scb_t) * MBOX_MAX_SCSI_CMDS, | 1051 | adapter->kscb_list = kcalloc(MBOX_MAX_SCSI_CMDS, sizeof(scb_t), GFP_KERNEL); |
1054 | GFP_KERNEL); | ||
1055 | 1052 | ||
1056 | if (adapter->kscb_list == NULL) { | 1053 | if (adapter->kscb_list == NULL) { |
1057 | con_log(CL_ANN, (KERN_WARNING | 1054 | con_log(CL_ANN, (KERN_WARNING |
@@ -1059,7 +1056,6 @@ megaraid_alloc_cmd_packets(adapter_t *adapter) | |||
1059 | __LINE__)); | 1056 | __LINE__)); |
1060 | goto out_free_ibuf; | 1057 | goto out_free_ibuf; |
1061 | } | 1058 | } |
1062 | memset(adapter->kscb_list, 0, sizeof(scb_t) * MBOX_MAX_SCSI_CMDS); | ||
1063 | 1059 | ||
1064 | // memory allocation for our command packets | 1060 | // memory allocation for our command packets |
1065 | if (megaraid_mbox_setup_dma_pools(adapter) != 0) { | 1061 | if (megaraid_mbox_setup_dma_pools(adapter) != 0) { |
@@ -3495,8 +3491,7 @@ megaraid_cmm_register(adapter_t *adapter) | |||
3495 | int i; | 3491 | int i; |
3496 | 3492 | ||
3497 | // Allocate memory for the base list of scb for management module. | 3493 | // Allocate memory for the base list of scb for management module. |
3498 | adapter->uscb_list = kmalloc(sizeof(scb_t) * MBOX_MAX_USER_CMDS, | 3494 | adapter->uscb_list = kcalloc(MBOX_MAX_USER_CMDS, sizeof(scb_t), GFP_KERNEL); |
3499 | GFP_KERNEL); | ||
3500 | 3495 | ||
3501 | if (adapter->uscb_list == NULL) { | 3496 | if (adapter->uscb_list == NULL) { |
3502 | con_log(CL_ANN, (KERN_WARNING | 3497 | con_log(CL_ANN, (KERN_WARNING |
@@ -3504,7 +3499,6 @@ megaraid_cmm_register(adapter_t *adapter) | |||
3504 | __LINE__)); | 3499 | __LINE__)); |
3505 | return -1; | 3500 | return -1; |
3506 | } | 3501 | } |
3507 | memset(adapter->uscb_list, 0, sizeof(scb_t) * MBOX_MAX_USER_CMDS); | ||
3508 | 3502 | ||
3509 | 3503 | ||
3510 | // Initialize the synchronization parameters for resources for | 3504 | // Initialize the synchronization parameters for resources for |
diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c index 84d9c27133d4..b6587a6d8486 100644 --- a/drivers/scsi/megaraid/megaraid_mm.c +++ b/drivers/scsi/megaraid/megaraid_mm.c | |||
@@ -890,12 +890,11 @@ mraid_mm_register_adp(mraid_mmadp_t *lld_adp) | |||
890 | if (lld_adp->drvr_type != DRVRTYPE_MBOX) | 890 | if (lld_adp->drvr_type != DRVRTYPE_MBOX) |
891 | return (-EINVAL); | 891 | return (-EINVAL); |
892 | 892 | ||
893 | adapter = kmalloc(sizeof(mraid_mmadp_t), GFP_KERNEL); | 893 | adapter = kzalloc(sizeof(mraid_mmadp_t), GFP_KERNEL); |
894 | 894 | ||
895 | if (!adapter) | 895 | if (!adapter) |
896 | return -ENOMEM; | 896 | return -ENOMEM; |
897 | 897 | ||
898 | memset(adapter, 0, sizeof(mraid_mmadp_t)); | ||
899 | 898 | ||
900 | adapter->unique_id = lld_adp->unique_id; | 899 | adapter->unique_id = lld_adp->unique_id; |
901 | adapter->drvr_type = lld_adp->drvr_type; | 900 | adapter->drvr_type = lld_adp->drvr_type; |
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index b7f2e613c903..ebb948c016bb 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c | |||
@@ -1636,15 +1636,13 @@ static int megasas_alloc_cmds(struct megasas_instance *instance) | |||
1636 | * Allocate the dynamic array first and then allocate individual | 1636 | * Allocate the dynamic array first and then allocate individual |
1637 | * commands. | 1637 | * commands. |
1638 | */ | 1638 | */ |
1639 | instance->cmd_list = kmalloc(sizeof(struct megasas_cmd *) * max_cmd, | 1639 | instance->cmd_list = kcalloc(max_cmd, sizeof(struct megasas_cmd*), GFP_KERNEL); |
1640 | GFP_KERNEL); | ||
1641 | 1640 | ||
1642 | if (!instance->cmd_list) { | 1641 | if (!instance->cmd_list) { |
1643 | printk(KERN_DEBUG "megasas: out of memory\n"); | 1642 | printk(KERN_DEBUG "megasas: out of memory\n"); |
1644 | return -ENOMEM; | 1643 | return -ENOMEM; |
1645 | } | 1644 | } |
1646 | 1645 | ||
1647 | memset(instance->cmd_list, 0, sizeof(struct megasas_cmd *) * max_cmd); | ||
1648 | 1646 | ||
1649 | for (i = 0; i < max_cmd; i++) { | 1647 | for (i = 0; i < max_cmd; i++) { |
1650 | instance->cmd_list[i] = kmalloc(sizeof(struct megasas_cmd), | 1648 | instance->cmd_list[i] = kmalloc(sizeof(struct megasas_cmd), |
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index 370802d24acd..2dd0dc9a9aed 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c | |||
@@ -106,9 +106,8 @@ static int aha152x_probe(struct pcmcia_device *link) | |||
106 | DEBUG(0, "aha152x_attach()\n"); | 106 | DEBUG(0, "aha152x_attach()\n"); |
107 | 107 | ||
108 | /* Create new SCSI device */ | 108 | /* Create new SCSI device */ |
109 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 109 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
110 | if (!info) return -ENOMEM; | 110 | if (!info) return -ENOMEM; |
111 | memset(info, 0, sizeof(*info)); | ||
112 | info->p_dev = link; | 111 | info->p_dev = link; |
113 | link->priv = info; | 112 | link->priv = info; |
114 | 113 | ||
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index c6f8c6e65e05..445cfbbca9b3 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c | |||
@@ -1602,9 +1602,8 @@ static int nsp_cs_probe(struct pcmcia_device *link) | |||
1602 | nsp_dbg(NSP_DEBUG_INIT, "in"); | 1602 | nsp_dbg(NSP_DEBUG_INIT, "in"); |
1603 | 1603 | ||
1604 | /* Create new SCSI device */ | 1604 | /* Create new SCSI device */ |
1605 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 1605 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
1606 | if (info == NULL) { return -ENOMEM; } | 1606 | if (info == NULL) { return -ENOMEM; } |
1607 | memset(info, 0, sizeof(*info)); | ||
1608 | info->p_dev = link; | 1607 | info->p_dev = link; |
1609 | link->priv = info; | 1608 | link->priv = info; |
1610 | data->ScsiInfo = info; | 1609 | data->ScsiInfo = info; |
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c index 697cfb76c3a4..67c5a58d17df 100644 --- a/drivers/scsi/pcmcia/qlogic_stub.c +++ b/drivers/scsi/pcmcia/qlogic_stub.c | |||
@@ -162,10 +162,9 @@ static int qlogic_probe(struct pcmcia_device *link) | |||
162 | DEBUG(0, "qlogic_attach()\n"); | 162 | DEBUG(0, "qlogic_attach()\n"); |
163 | 163 | ||
164 | /* Create new SCSI device */ | 164 | /* Create new SCSI device */ |
165 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 165 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
166 | if (!info) | 166 | if (!info) |
167 | return -ENOMEM; | 167 | return -ENOMEM; |
168 | memset(info, 0, sizeof(*info)); | ||
169 | info->p_dev = link; | 168 | info->p_dev = link; |
170 | link->priv = info; | 169 | link->priv = info; |
171 | link->io.NumPorts1 = 16; | 170 | link->io.NumPorts1 = 16; |
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index 2695b7187b2f..961839ecfe86 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c | |||
@@ -875,10 +875,9 @@ SYM53C500_probe(struct pcmcia_device *link) | |||
875 | DEBUG(0, "SYM53C500_attach()\n"); | 875 | DEBUG(0, "SYM53C500_attach()\n"); |
876 | 876 | ||
877 | /* Create new SCSI device */ | 877 | /* Create new SCSI device */ |
878 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 878 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
879 | if (!info) | 879 | if (!info) |
880 | return -ENOMEM; | 880 | return -ENOMEM; |
881 | memset(info, 0, sizeof(*info)); | ||
882 | info->p_dev = link; | 881 | info->p_dev = link; |
883 | link->priv = info; | 882 | link->priv = info; |
884 | link->io.NumPorts1 = 16; | 883 | link->io.NumPorts1 = 16; |
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c index 2f1fa1eb7e90..67b6d76a6c8d 100644 --- a/drivers/scsi/ppa.c +++ b/drivers/scsi/ppa.c | |||
@@ -1014,10 +1014,9 @@ static int __ppa_attach(struct parport *pb) | |||
1014 | int modes, ppb, ppb_hi; | 1014 | int modes, ppb, ppb_hi; |
1015 | int err = -ENOMEM; | 1015 | int err = -ENOMEM; |
1016 | 1016 | ||
1017 | dev = kmalloc(sizeof(ppa_struct), GFP_KERNEL); | 1017 | dev = kzalloc(sizeof(ppa_struct), GFP_KERNEL); |
1018 | if (!dev) | 1018 | if (!dev) |
1019 | return -ENOMEM; | 1019 | return -ENOMEM; |
1020 | memset(dev, 0, sizeof(ppa_struct)); | ||
1021 | dev->base = -1; | 1020 | dev->base = -1; |
1022 | dev->mode = PPA_AUTODETECT; | 1021 | dev->mode = PPA_AUTODETECT; |
1023 | dev->recon_tmo = PPA_RECON_TMO; | 1022 | dev->recon_tmo = PPA_RECON_TMO; |
diff --git a/drivers/scsi/sim710.c b/drivers/scsi/sim710.c index 018c65f73ac4..710f19de3d40 100644 --- a/drivers/scsi/sim710.c +++ b/drivers/scsi/sim710.c | |||
@@ -100,7 +100,7 @@ sim710_probe_common(struct device *dev, unsigned long base_addr, | |||
100 | { | 100 | { |
101 | struct Scsi_Host * host = NULL; | 101 | struct Scsi_Host * host = NULL; |
102 | struct NCR_700_Host_Parameters *hostdata = | 102 | struct NCR_700_Host_Parameters *hostdata = |
103 | kmalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL); | 103 | kzalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL); |
104 | 104 | ||
105 | printk(KERN_NOTICE "sim710: %s\n", dev->bus_id); | 105 | printk(KERN_NOTICE "sim710: %s\n", dev->bus_id); |
106 | printk(KERN_NOTICE "sim710: irq = %d, clock = %d, base = 0x%lx, scsi_id = %d\n", | 106 | printk(KERN_NOTICE "sim710: irq = %d, clock = %d, base = 0x%lx, scsi_id = %d\n", |
@@ -110,7 +110,6 @@ sim710_probe_common(struct device *dev, unsigned long base_addr, | |||
110 | printk(KERN_ERR "sim710: Failed to allocate host data\n"); | 110 | printk(KERN_ERR "sim710: Failed to allocate host data\n"); |
111 | goto out; | 111 | goto out; |
112 | } | 112 | } |
113 | memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters)); | ||
114 | 113 | ||
115 | if(request_region(base_addr, 64, "sim710") == NULL) { | 114 | if(request_region(base_addr, 64, "sim710") == NULL) { |
116 | printk(KERN_ERR "sim710: Failed to reserve IO region 0x%lx\n", | 115 | printk(KERN_ERR "sim710: Failed to reserve IO region 0x%lx\n", |
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c index 14cba1ca38b3..5db1520f8ba9 100644 --- a/drivers/scsi/tmscsim.c +++ b/drivers/scsi/tmscsim.c | |||
@@ -2082,10 +2082,9 @@ static int dc390_slave_alloc(struct scsi_device *scsi_device) | |||
2082 | uint id = scsi_device->id; | 2082 | uint id = scsi_device->id; |
2083 | uint lun = scsi_device->lun; | 2083 | uint lun = scsi_device->lun; |
2084 | 2084 | ||
2085 | pDCB = kmalloc(sizeof(struct dc390_dcb), GFP_KERNEL); | 2085 | pDCB = kzalloc(sizeof(struct dc390_dcb), GFP_KERNEL); |
2086 | if (!pDCB) | 2086 | if (!pDCB) |
2087 | return -ENOMEM; | 2087 | return -ENOMEM; |
2088 | memset(pDCB, 0, sizeof(struct dc390_dcb)); | ||
2089 | 2088 | ||
2090 | if (!pACB->DCBCnt++) { | 2089 | if (!pACB->DCBCnt++) { |
2091 | pACB->pLinkDCB = pDCB; | 2090 | pACB->pLinkDCB = pDCB; |
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c index 954073c6ce3a..72229df9dc11 100644 --- a/drivers/serial/amba-pl011.c +++ b/drivers/serial/amba-pl011.c | |||
@@ -716,7 +716,7 @@ static int pl011_probe(struct amba_device *dev, void *id) | |||
716 | goto out; | 716 | goto out; |
717 | } | 717 | } |
718 | 718 | ||
719 | uap = kmalloc(sizeof(struct uart_amba_port), GFP_KERNEL); | 719 | uap = kzalloc(sizeof(struct uart_amba_port), GFP_KERNEL); |
720 | if (uap == NULL) { | 720 | if (uap == NULL) { |
721 | ret = -ENOMEM; | 721 | ret = -ENOMEM; |
722 | goto out; | 722 | goto out; |
@@ -728,7 +728,6 @@ static int pl011_probe(struct amba_device *dev, void *id) | |||
728 | goto free; | 728 | goto free; |
729 | } | 729 | } |
730 | 730 | ||
731 | memset(uap, 0, sizeof(struct uart_amba_port)); | ||
732 | uap->clk = clk_get(&dev->dev, "UARTCLK"); | 731 | uap->clk = clk_get(&dev->dev, "UARTCLK"); |
733 | if (IS_ERR(uap->clk)) { | 732 | if (IS_ERR(uap->clk)) { |
734 | ret = PTR_ERR(uap->clk); | 733 | ret = PTR_ERR(uap->clk); |
diff --git a/drivers/sh/superhyway/superhyway.c b/drivers/sh/superhyway/superhyway.c index 94b229031198..7d873b3b0513 100644 --- a/drivers/sh/superhyway/superhyway.c +++ b/drivers/sh/superhyway/superhyway.c | |||
@@ -56,11 +56,10 @@ int superhyway_add_device(unsigned long base, struct superhyway_device *sdev, | |||
56 | struct superhyway_device *dev = sdev; | 56 | struct superhyway_device *dev = sdev; |
57 | 57 | ||
58 | if (!dev) { | 58 | if (!dev) { |
59 | dev = kmalloc(sizeof(struct superhyway_device), GFP_KERNEL); | 59 | dev = kzalloc(sizeof(struct superhyway_device), GFP_KERNEL); |
60 | if (!dev) | 60 | if (!dev) |
61 | return -ENOMEM; | 61 | return -ENOMEM; |
62 | 62 | ||
63 | memset(dev, 0, sizeof(struct superhyway_device)); | ||
64 | } | 63 | } |
65 | 64 | ||
66 | dev->bus = bus; | 65 | dev->bus = bus; |
diff --git a/drivers/sn/ioc3.c b/drivers/sn/ioc3.c index 2dd6eed50aa0..29fcd6d0301d 100644 --- a/drivers/sn/ioc3.c +++ b/drivers/sn/ioc3.c | |||
@@ -629,7 +629,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
629 | #endif | 629 | #endif |
630 | 630 | ||
631 | /* Set up per-IOC3 data */ | 631 | /* Set up per-IOC3 data */ |
632 | idd = kmalloc(sizeof(struct ioc3_driver_data), GFP_KERNEL); | 632 | idd = kzalloc(sizeof(struct ioc3_driver_data), GFP_KERNEL); |
633 | if (!idd) { | 633 | if (!idd) { |
634 | printk(KERN_WARNING | 634 | printk(KERN_WARNING |
635 | "%s: Failed to allocate IOC3 data for pci_dev %s.\n", | 635 | "%s: Failed to allocate IOC3 data for pci_dev %s.\n", |
@@ -637,7 +637,6 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
637 | ret = -ENODEV; | 637 | ret = -ENODEV; |
638 | goto out_idd; | 638 | goto out_idd; |
639 | } | 639 | } |
640 | memset(idd, 0, sizeof(struct ioc3_driver_data)); | ||
641 | spin_lock_init(&idd->ir_lock); | 640 | spin_lock_init(&idd->ir_lock); |
642 | spin_lock_init(&idd->gpio_lock); | 641 | spin_lock_init(&idd->gpio_lock); |
643 | idd->pdev = pdev; | 642 | idd->pdev = pdev; |
diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c index 3e658dc7c2d8..ff9a29b76336 100644 --- a/drivers/telephony/ixj_pcmcia.c +++ b/drivers/telephony/ixj_pcmcia.c | |||
@@ -45,11 +45,10 @@ static int ixj_probe(struct pcmcia_device *p_dev) | |||
45 | p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 45 | p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_8; |
46 | p_dev->io.IOAddrLines = 3; | 46 | p_dev->io.IOAddrLines = 3; |
47 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | 47 | p_dev->conf.IntType = INT_MEMORY_AND_IO; |
48 | p_dev->priv = kmalloc(sizeof(struct ixj_info_t), GFP_KERNEL); | 48 | p_dev->priv = kzalloc(sizeof(struct ixj_info_t), GFP_KERNEL); |
49 | if (!p_dev->priv) { | 49 | if (!p_dev->priv) { |
50 | return -ENOMEM; | 50 | return -ENOMEM; |
51 | } | 51 | } |
52 | memset(p_dev->priv, 0, sizeof(struct ixj_info_t)); | ||
53 | 52 | ||
54 | return ixj_config(p_dev); | 53 | return ixj_config(p_dev); |
55 | } | 54 | } |
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c index d6c5f1150ae7..349b8166f34a 100644 --- a/drivers/usb/gadget/goku_udc.c +++ b/drivers/usb/gadget/goku_udc.c | |||
@@ -1777,14 +1777,13 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1777 | } | 1777 | } |
1778 | 1778 | ||
1779 | /* alloc, and start init */ | 1779 | /* alloc, and start init */ |
1780 | dev = kmalloc (sizeof *dev, GFP_KERNEL); | 1780 | dev = kzalloc (sizeof *dev, GFP_KERNEL); |
1781 | if (dev == NULL){ | 1781 | if (dev == NULL){ |
1782 | pr_debug("enomem %s\n", pci_name(pdev)); | 1782 | pr_debug("enomem %s\n", pci_name(pdev)); |
1783 | retval = -ENOMEM; | 1783 | retval = -ENOMEM; |
1784 | goto done; | 1784 | goto done; |
1785 | } | 1785 | } |
1786 | 1786 | ||
1787 | memset(dev, 0, sizeof *dev); | ||
1788 | spin_lock_init(&dev->lock); | 1787 | spin_lock_init(&dev->lock); |
1789 | dev->pdev = pdev; | 1788 | dev->pdev = pdev; |
1790 | dev->gadget.ops = &goku_ops; | 1789 | dev->gadget.ops = &goku_ops; |
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c index dd33ff0ae4ce..38138bb9ddb0 100644 --- a/drivers/usb/gadget/serial.c +++ b/drivers/usb/gadget/serial.c | |||
@@ -1427,7 +1427,7 @@ static int __init gs_bind(struct usb_gadget *gadget) | |||
1427 | gs_acm_config_desc.bmAttributes |= USB_CONFIG_ATT_WAKEUP; | 1427 | gs_acm_config_desc.bmAttributes |= USB_CONFIG_ATT_WAKEUP; |
1428 | } | 1428 | } |
1429 | 1429 | ||
1430 | gs_device = dev = kmalloc(sizeof(struct gs_dev), GFP_KERNEL); | 1430 | gs_device = dev = kzalloc(sizeof(struct gs_dev), GFP_KERNEL); |
1431 | if (dev == NULL) | 1431 | if (dev == NULL) |
1432 | return -ENOMEM; | 1432 | return -ENOMEM; |
1433 | 1433 | ||
@@ -1435,7 +1435,6 @@ static int __init gs_bind(struct usb_gadget *gadget) | |||
1435 | init_utsname()->sysname, init_utsname()->release, | 1435 | init_utsname()->sysname, init_utsname()->release, |
1436 | gadget->name); | 1436 | gadget->name); |
1437 | 1437 | ||
1438 | memset(dev, 0, sizeof(struct gs_dev)); | ||
1439 | dev->dev_gadget = gadget; | 1438 | dev->dev_gadget = gadget; |
1440 | spin_lock_init(&dev->dev_lock); | 1439 | spin_lock_init(&dev->dev_lock); |
1441 | INIT_LIST_HEAD(&dev->dev_req_list); | 1440 | INIT_LIST_HEAD(&dev->dev_req_list); |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 2038125b7f8c..6edf4097d2d2 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -171,11 +171,10 @@ static int ohci_urb_enqueue ( | |||
171 | } | 171 | } |
172 | 172 | ||
173 | /* allocate the private part of the URB */ | 173 | /* allocate the private part of the URB */ |
174 | urb_priv = kmalloc (sizeof (urb_priv_t) + size * sizeof (struct td *), | 174 | urb_priv = kzalloc (sizeof (urb_priv_t) + size * sizeof (struct td *), |
175 | mem_flags); | 175 | mem_flags); |
176 | if (!urb_priv) | 176 | if (!urb_priv) |
177 | return -ENOMEM; | 177 | return -ENOMEM; |
178 | memset (urb_priv, 0, sizeof (urb_priv_t) + size * sizeof (struct td *)); | ||
179 | INIT_LIST_HEAD (&urb_priv->pending); | 178 | INIT_LIST_HEAD (&urb_priv->pending); |
180 | urb_priv->length = size; | 179 | urb_priv->length = size; |
181 | urb_priv->ed = ed; | 180 | urb_priv->ed = ed; |
diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index 2d0e73b20099..5da63f535005 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c | |||
@@ -278,10 +278,9 @@ static int sl811_cs_probe(struct pcmcia_device *link) | |||
278 | { | 278 | { |
279 | local_info_t *local; | 279 | local_info_t *local; |
280 | 280 | ||
281 | local = kmalloc(sizeof(local_info_t), GFP_KERNEL); | 281 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
282 | if (!local) | 282 | if (!local) |
283 | return -ENOMEM; | 283 | return -ENOMEM; |
284 | memset(local, 0, sizeof(local_info_t)); | ||
285 | local->p_dev = link; | 284 | local->p_dev = link; |
286 | link->priv = local; | 285 | link->priv = local; |
287 | 286 | ||
diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c index 6c9dc2e69c82..a7a1c891bfa2 100644 --- a/drivers/video/amba-clcd.c +++ b/drivers/video/amba-clcd.c | |||
@@ -447,13 +447,12 @@ static int clcdfb_probe(struct amba_device *dev, void *id) | |||
447 | goto out; | 447 | goto out; |
448 | } | 448 | } |
449 | 449 | ||
450 | fb = kmalloc(sizeof(struct clcd_fb), GFP_KERNEL); | 450 | fb = kzalloc(sizeof(struct clcd_fb), GFP_KERNEL); |
451 | if (!fb) { | 451 | if (!fb) { |
452 | printk(KERN_INFO "CLCD: could not allocate new clcd_fb struct\n"); | 452 | printk(KERN_INFO "CLCD: could not allocate new clcd_fb struct\n"); |
453 | ret = -ENOMEM; | 453 | ret = -ENOMEM; |
454 | goto free_region; | 454 | goto free_region; |
455 | } | 455 | } |
456 | memset(fb, 0, sizeof(struct clcd_fb)); | ||
457 | 456 | ||
458 | fb->dev = dev; | 457 | fb->dev = dev; |
459 | fb->board = board; | 458 | fb->board = board; |
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index ef330e34d031..0c7bf75732ea 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -2937,12 +2937,11 @@ static int __devinit atyfb_setup_sparc(struct pci_dev *pdev, | |||
2937 | /* nothing */ ; | 2937 | /* nothing */ ; |
2938 | j = i + 4; | 2938 | j = i + 4; |
2939 | 2939 | ||
2940 | par->mmap_map = kmalloc(j * sizeof(*par->mmap_map), GFP_ATOMIC); | 2940 | par->mmap_map = kcalloc(j, sizeof(*par->mmap_map), GFP_ATOMIC); |
2941 | if (!par->mmap_map) { | 2941 | if (!par->mmap_map) { |
2942 | PRINTKE("atyfb_setup_sparc() can't alloc mmap_map\n"); | 2942 | PRINTKE("atyfb_setup_sparc() can't alloc mmap_map\n"); |
2943 | return -ENOMEM; | 2943 | return -ENOMEM; |
2944 | } | 2944 | } |
2945 | memset(par->mmap_map, 0, j * sizeof(*par->mmap_map)); | ||
2946 | 2945 | ||
2947 | for (i = 0, j = 2; i < 6 && pdev->resource[i].start; i++) { | 2946 | for (i = 0, j = 2; i < 6 && pdev->resource[i].start; i++) { |
2948 | struct resource *rp = &pdev->resource[i]; | 2947 | struct resource *rp = &pdev->resource[i]; |
diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c index dbf4ec3f6d57..03e57ef88378 100644 --- a/drivers/video/au1200fb.c +++ b/drivers/video/au1200fb.c | |||
@@ -1589,11 +1589,10 @@ static int au1200fb_init_fbinfo(struct au1200fb_device *fbdev) | |||
1589 | return -EFAULT; | 1589 | return -EFAULT; |
1590 | } | 1590 | } |
1591 | 1591 | ||
1592 | fbi->pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL); | 1592 | fbi->pseudo_palette = kcalloc(16, sizeof(u32), GFP_KERNEL); |
1593 | if (!fbi->pseudo_palette) { | 1593 | if (!fbi->pseudo_palette) { |
1594 | return -ENOMEM; | 1594 | return -ENOMEM; |
1595 | } | 1595 | } |
1596 | memset(fbi->pseudo_palette, 0, sizeof(u32) * 16); | ||
1597 | 1596 | ||
1598 | if (fb_alloc_cmap(&fbi->cmap, AU1200_LCD_NBR_PALETTE_ENTRIES, 0) < 0) { | 1597 | if (fb_alloc_cmap(&fbi->cmap, AU1200_LCD_NBR_PALETTE_ENTRIES, 0) < 0) { |
1599 | print_err("Fail to allocate colormap (%d entries)", | 1598 | print_err("Fail to allocate colormap (%d entries)", |
diff --git a/drivers/video/clps711xfb.c b/drivers/video/clps711xfb.c index 50b78af0fa24..dea6579941b7 100644 --- a/drivers/video/clps711xfb.c +++ b/drivers/video/clps711xfb.c | |||
@@ -366,11 +366,10 @@ int __init clps711xfb_init(void) | |||
366 | if (fb_get_options("clps711xfb", NULL)) | 366 | if (fb_get_options("clps711xfb", NULL)) |
367 | return -ENODEV; | 367 | return -ENODEV; |
368 | 368 | ||
369 | cfb = kmalloc(sizeof(*cfb), GFP_KERNEL); | 369 | cfb = kzalloc(sizeof(*cfb), GFP_KERNEL); |
370 | if (!cfb) | 370 | if (!cfb) |
371 | goto out; | 371 | goto out; |
372 | 372 | ||
373 | memset(cfb, 0, sizeof(*cfb)); | ||
374 | strcpy(cfb->fix.id, "clps711x"); | 373 | strcpy(cfb->fix.id, "clps711x"); |
375 | 374 | ||
376 | cfb->fbops = &clps7111fb_ops; | 375 | cfb->fbops = &clps7111fb_ops; |
diff --git a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c index 7a6eeda5ae9a..30ede6e8830f 100644 --- a/drivers/video/cyber2000fb.c +++ b/drivers/video/cyber2000fb.c | |||
@@ -1221,11 +1221,10 @@ cyberpro_alloc_fb_info(unsigned int id, char *name) | |||
1221 | { | 1221 | { |
1222 | struct cfb_info *cfb; | 1222 | struct cfb_info *cfb; |
1223 | 1223 | ||
1224 | cfb = kmalloc(sizeof(struct cfb_info), GFP_KERNEL); | 1224 | cfb = kzalloc(sizeof(struct cfb_info), GFP_KERNEL); |
1225 | if (!cfb) | 1225 | if (!cfb) |
1226 | return NULL; | 1226 | return NULL; |
1227 | 1227 | ||
1228 | memset(cfb, 0, sizeof(struct cfb_info)); | ||
1229 | 1228 | ||
1230 | cfb->id = id; | 1229 | cfb->id = id; |
1231 | 1230 | ||
diff --git a/drivers/video/pvr2fb.c b/drivers/video/pvr2fb.c index 0f88c30f94f8..f9300266044d 100644 --- a/drivers/video/pvr2fb.c +++ b/drivers/video/pvr2fb.c | |||
@@ -1082,13 +1082,12 @@ static int __init pvr2fb_init(void) | |||
1082 | #endif | 1082 | #endif |
1083 | size = sizeof(struct fb_info) + sizeof(struct pvr2fb_par) + 16 * sizeof(u32); | 1083 | size = sizeof(struct fb_info) + sizeof(struct pvr2fb_par) + 16 * sizeof(u32); |
1084 | 1084 | ||
1085 | fb_info = kmalloc(size, GFP_KERNEL); | 1085 | fb_info = kzalloc(size, GFP_KERNEL); |
1086 | if (!fb_info) { | 1086 | if (!fb_info) { |
1087 | printk(KERN_ERR "Failed to allocate memory for fb_info\n"); | 1087 | printk(KERN_ERR "Failed to allocate memory for fb_info\n"); |
1088 | return -ENOMEM; | 1088 | return -ENOMEM; |
1089 | } | 1089 | } |
1090 | 1090 | ||
1091 | memset(fb_info, 0, size); | ||
1092 | 1091 | ||
1093 | currentpar = (struct pvr2fb_par *)(fb_info + 1); | 1092 | currentpar = (struct pvr2fb_par *)(fb_info + 1); |
1094 | 1093 | ||
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c index 3d7507ad55f6..b855f4a34afe 100644 --- a/drivers/video/savage/savagefb_driver.c +++ b/drivers/video/savage/savagefb_driver.c | |||
@@ -2174,11 +2174,10 @@ static int __devinit savage_init_fb_info(struct fb_info *info, | |||
2174 | 2174 | ||
2175 | #if defined(CONFIG_FB_SAVAGE_ACCEL) | 2175 | #if defined(CONFIG_FB_SAVAGE_ACCEL) |
2176 | /* FIFO size + padding for commands */ | 2176 | /* FIFO size + padding for commands */ |
2177 | info->pixmap.addr = kmalloc(8*1024, GFP_KERNEL); | 2177 | info->pixmap.addr = kcalloc(8, 1024, GFP_KERNEL); |
2178 | 2178 | ||
2179 | err = -ENOMEM; | 2179 | err = -ENOMEM; |
2180 | if (info->pixmap.addr) { | 2180 | if (info->pixmap.addr) { |
2181 | memset(info->pixmap.addr, 0, 8*1024); | ||
2182 | info->pixmap.size = 8*1024; | 2181 | info->pixmap.size = 8*1024; |
2183 | info->pixmap.scan_align = 4; | 2182 | info->pixmap.scan_align = 4; |
2184 | info->pixmap.buf_align = 4; | 2183 | info->pixmap.buf_align = 4; |
diff --git a/drivers/video/valkyriefb.c b/drivers/video/valkyriefb.c index ad66f070acb8..7b0cef9ca8f9 100644 --- a/drivers/video/valkyriefb.c +++ b/drivers/video/valkyriefb.c | |||
@@ -356,10 +356,9 @@ int __init valkyriefb_init(void) | |||
356 | } | 356 | } |
357 | #endif /* ppc (!CONFIG_MAC) */ | 357 | #endif /* ppc (!CONFIG_MAC) */ |
358 | 358 | ||
359 | p = kmalloc(sizeof(*p), GFP_ATOMIC); | 359 | p = kzalloc(sizeof(*p), GFP_ATOMIC); |
360 | if (p == 0) | 360 | if (p == 0) |
361 | return -ENOMEM; | 361 | return -ENOMEM; |
362 | memset(p, 0, sizeof(*p)); | ||
363 | 362 | ||
364 | /* Map in frame buffer and registers */ | 363 | /* Map in frame buffer and registers */ |
365 | if (!request_mem_region(frame_buffer_phys, 0x100000, "valkyriefb")) { | 364 | if (!request_mem_region(frame_buffer_phys, 0x100000, "valkyriefb")) { |
diff --git a/drivers/w1/masters/matrox_w1.c b/drivers/w1/masters/matrox_w1.c index 6f9d880ab2e9..d356da5709fc 100644 --- a/drivers/w1/masters/matrox_w1.c +++ b/drivers/w1/masters/matrox_w1.c | |||
@@ -164,7 +164,7 @@ static int __devinit matrox_w1_probe(struct pci_dev *pdev, const struct pci_devi | |||
164 | if (pdev->vendor != PCI_VENDOR_ID_MATROX || pdev->device != PCI_DEVICE_ID_MATROX_G400) | 164 | if (pdev->vendor != PCI_VENDOR_ID_MATROX || pdev->device != PCI_DEVICE_ID_MATROX_G400) |
165 | return -ENODEV; | 165 | return -ENODEV; |
166 | 166 | ||
167 | dev = kmalloc(sizeof(struct matrox_device) + | 167 | dev = kzalloc(sizeof(struct matrox_device) + |
168 | sizeof(struct w1_bus_master), GFP_KERNEL); | 168 | sizeof(struct w1_bus_master), GFP_KERNEL); |
169 | if (!dev) { | 169 | if (!dev) { |
170 | dev_err(&pdev->dev, | 170 | dev_err(&pdev->dev, |
@@ -173,7 +173,6 @@ static int __devinit matrox_w1_probe(struct pci_dev *pdev, const struct pci_devi | |||
173 | return -ENOMEM; | 173 | return -ENOMEM; |
174 | } | 174 | } |
175 | 175 | ||
176 | memset(dev, 0, sizeof(struct matrox_device) + sizeof(struct w1_bus_master)); | ||
177 | 176 | ||
178 | dev->bus_master = (struct w1_bus_master *)(dev + 1); | 177 | dev->bus_master = (struct w1_bus_master *)(dev + 1); |
179 | 178 | ||
diff --git a/drivers/w1/slaves/w1_ds2433.c b/drivers/w1/slaves/w1_ds2433.c index cab56005dd49..858c16a544c2 100644 --- a/drivers/w1/slaves/w1_ds2433.c +++ b/drivers/w1/slaves/w1_ds2433.c | |||
@@ -266,10 +266,9 @@ static int w1_f23_add_slave(struct w1_slave *sl) | |||
266 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC | 266 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC |
267 | struct w1_f23_data *data; | 267 | struct w1_f23_data *data; |
268 | 268 | ||
269 | data = kmalloc(sizeof(struct w1_f23_data), GFP_KERNEL); | 269 | data = kzalloc(sizeof(struct w1_f23_data), GFP_KERNEL); |
270 | if (!data) | 270 | if (!data) |
271 | return -ENOMEM; | 271 | return -ENOMEM; |
272 | memset(data, 0, sizeof(struct w1_f23_data)); | ||
273 | sl->family_data = data; | 272 | sl->family_data = data; |
274 | 273 | ||
275 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ | 274 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ |
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index c6332108f1c5..8d7ab74170d5 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c | |||
@@ -520,7 +520,7 @@ static int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn) | |||
520 | int err; | 520 | int err; |
521 | struct w1_netlink_msg msg; | 521 | struct w1_netlink_msg msg; |
522 | 522 | ||
523 | sl = kmalloc(sizeof(struct w1_slave), GFP_KERNEL); | 523 | sl = kzalloc(sizeof(struct w1_slave), GFP_KERNEL); |
524 | if (!sl) { | 524 | if (!sl) { |
525 | dev_err(&dev->dev, | 525 | dev_err(&dev->dev, |
526 | "%s: failed to allocate new slave device.\n", | 526 | "%s: failed to allocate new slave device.\n", |
@@ -528,7 +528,6 @@ static int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn) | |||
528 | return -ENOMEM; | 528 | return -ENOMEM; |
529 | } | 529 | } |
530 | 530 | ||
531 | memset(sl, 0, sizeof(*sl)); | ||
532 | 531 | ||
533 | sl->owner = THIS_MODULE; | 532 | sl->owner = THIS_MODULE; |
534 | sl->master = dev; | 533 | sl->master = dev; |
diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c index 258defdb2efd..2fbd8dd16df5 100644 --- a/drivers/w1/w1_int.c +++ b/drivers/w1/w1_int.c | |||
@@ -41,7 +41,7 @@ static struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl, | |||
41 | /* | 41 | /* |
42 | * We are in process context(kernel thread), so can sleep. | 42 | * We are in process context(kernel thread), so can sleep. |
43 | */ | 43 | */ |
44 | dev = kmalloc(sizeof(struct w1_master) + sizeof(struct w1_bus_master), GFP_KERNEL); | 44 | dev = kzalloc(sizeof(struct w1_master) + sizeof(struct w1_bus_master), GFP_KERNEL); |
45 | if (!dev) { | 45 | if (!dev) { |
46 | printk(KERN_ERR | 46 | printk(KERN_ERR |
47 | "Failed to allocate %zd bytes for new w1 device.\n", | 47 | "Failed to allocate %zd bytes for new w1 device.\n", |
@@ -49,7 +49,6 @@ static struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl, | |||
49 | return NULL; | 49 | return NULL; |
50 | } | 50 | } |
51 | 51 | ||
52 | memset(dev, 0, sizeof(struct w1_master) + sizeof(struct w1_bus_master)); | ||
53 | 52 | ||
54 | dev->bus_master = (struct w1_bus_master *)(dev + 1); | 53 | dev->bus_master = (struct w1_bus_master *)(dev + 1); |
55 | 54 | ||