diff options
author | Burman Yan <yan_952@hotmail.com> | 2006-12-08 05:39:35 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:29:01 -0500 |
commit | 41f96935b4c41daea2c4dbbf137960375cf764c1 (patch) | |
tree | 9af3af5e41f68baf063b5f929797c837169bb9df | |
parent | 0b2dd130a5a8774a30de1f94266f6b9a9892153c (diff) |
[PATCH] isdn: replace kmalloc+memset with kzalloc
Acked-by: Karsten Keil <kkeil@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
30 files changed, 46 insertions, 99 deletions
diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c index 90593e2ef872..e3e5c1399076 100644 --- a/drivers/isdn/act2000/module.c +++ b/drivers/isdn/act2000/module.c | |||
@@ -573,12 +573,11 @@ act2000_alloccard(int bus, int port, int irq, char *id) | |||
573 | { | 573 | { |
574 | int i; | 574 | int i; |
575 | act2000_card *card; | 575 | act2000_card *card; |
576 | if (!(card = (act2000_card *) kmalloc(sizeof(act2000_card), GFP_KERNEL))) { | 576 | if (!(card = kzalloc(sizeof(act2000_card), GFP_KERNEL))) { |
577 | printk(KERN_WARNING | 577 | printk(KERN_WARNING |
578 | "act2000: (%s) Could not allocate card-struct.\n", id); | 578 | "act2000: (%s) Could not allocate card-struct.\n", id); |
579 | return; | 579 | return; |
580 | } | 580 | } |
581 | memset((char *) card, 0, sizeof(act2000_card)); | ||
582 | spin_lock_init(&card->lock); | 581 | spin_lock_init(&card->lock); |
583 | spin_lock_init(&card->mnlock); | 582 | spin_lock_init(&card->mnlock); |
584 | skb_queue_head_init(&card->sndq); | 583 | skb_queue_head_init(&card->sndq); |
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 0475a54df83a..d22c0224fde6 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c | |||
@@ -215,13 +215,12 @@ static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci) | |||
215 | unsigned int minor = 0; | 215 | unsigned int minor = 0; |
216 | unsigned long flags; | 216 | unsigned long flags; |
217 | 217 | ||
218 | mp = kmalloc(sizeof(*mp), GFP_ATOMIC); | 218 | mp = kzalloc(sizeof(*mp), GFP_ATOMIC); |
219 | if (!mp) { | 219 | if (!mp) { |
220 | printk(KERN_ERR "capi: can't alloc capiminor\n"); | 220 | printk(KERN_ERR "capi: can't alloc capiminor\n"); |
221 | return NULL; | 221 | return NULL; |
222 | } | 222 | } |
223 | 223 | ||
224 | memset(mp, 0, sizeof(struct capiminor)); | ||
225 | mp->ap = ap; | 224 | mp->ap = ap; |
226 | mp->ncci = ncci; | 225 | mp->ncci = ncci; |
227 | mp->msgid = 0; | 226 | mp->msgid = 0; |
@@ -304,10 +303,9 @@ static struct capincci *capincci_alloc(struct capidev *cdev, u32 ncci) | |||
304 | struct capiminor *mp = NULL; | 303 | struct capiminor *mp = NULL; |
305 | #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ | 304 | #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ |
306 | 305 | ||
307 | np = kmalloc(sizeof(*np), GFP_ATOMIC); | 306 | np = kzalloc(sizeof(*np), GFP_ATOMIC); |
308 | if (!np) | 307 | if (!np) |
309 | return NULL; | 308 | return NULL; |
310 | memset(np, 0, sizeof(struct capincci)); | ||
311 | np->ncci = ncci; | 309 | np->ncci = ncci; |
312 | np->cdev = cdev; | 310 | np->cdev = cdev; |
313 | #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE | 311 | #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE |
@@ -384,10 +382,9 @@ static struct capidev *capidev_alloc(void) | |||
384 | struct capidev *cdev; | 382 | struct capidev *cdev; |
385 | unsigned long flags; | 383 | unsigned long flags; |
386 | 384 | ||
387 | cdev = kmalloc(sizeof(*cdev), GFP_KERNEL); | 385 | cdev = kzalloc(sizeof(*cdev), GFP_KERNEL); |
388 | if (!cdev) | 386 | if (!cdev) |
389 | return NULL; | 387 | return NULL; |
390 | memset(cdev, 0, sizeof(struct capidev)); | ||
391 | 388 | ||
392 | init_MUTEX(&cdev->ncci_list_sem); | 389 | init_MUTEX(&cdev->ncci_list_sem); |
393 | skb_queue_head_init(&cdev->recvqueue); | 390 | skb_queue_head_init(&cdev->recvqueue); |
diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c index b6f9476c0501..097bfa7bc323 100644 --- a/drivers/isdn/capi/capidrv.c +++ b/drivers/isdn/capi/capidrv.c | |||
@@ -334,12 +334,11 @@ static capidrv_plci *new_plci(capidrv_contr * card, int chan) | |||
334 | { | 334 | { |
335 | capidrv_plci *plcip; | 335 | capidrv_plci *plcip; |
336 | 336 | ||
337 | plcip = (capidrv_plci *) kmalloc(sizeof(capidrv_plci), GFP_ATOMIC); | 337 | plcip = kzalloc(sizeof(capidrv_plci), GFP_ATOMIC); |
338 | 338 | ||
339 | if (plcip == 0) | 339 | if (plcip == 0) |
340 | return NULL; | 340 | return NULL; |
341 | 341 | ||
342 | memset(plcip, 0, sizeof(capidrv_plci)); | ||
343 | plcip->state = ST_PLCI_NONE; | 342 | plcip->state = ST_PLCI_NONE; |
344 | plcip->plci = 0; | 343 | plcip->plci = 0; |
345 | plcip->msgid = 0; | 344 | plcip->msgid = 0; |
@@ -404,12 +403,11 @@ static inline capidrv_ncci *new_ncci(capidrv_contr * card, | |||
404 | { | 403 | { |
405 | capidrv_ncci *nccip; | 404 | capidrv_ncci *nccip; |
406 | 405 | ||
407 | nccip = (capidrv_ncci *) kmalloc(sizeof(capidrv_ncci), GFP_ATOMIC); | 406 | nccip = kzalloc(sizeof(capidrv_ncci), GFP_ATOMIC); |
408 | 407 | ||
409 | if (nccip == 0) | 408 | if (nccip == 0) |
410 | return NULL; | 409 | return NULL; |
411 | 410 | ||
412 | memset(nccip, 0, sizeof(capidrv_ncci)); | ||
413 | nccip->ncci = ncci; | 411 | nccip->ncci = ncci; |
414 | nccip->state = ST_NCCI_NONE; | 412 | nccip->state = ST_NCCI_NONE; |
415 | nccip->plcip = plcip; | 413 | nccip->plcip = plcip; |
@@ -2005,12 +2003,11 @@ static int capidrv_addcontr(u16 contr, struct capi_profile *profp) | |||
2005 | printk(KERN_WARNING "capidrv: (%s) Could not reserve module\n", id); | 2003 | printk(KERN_WARNING "capidrv: (%s) Could not reserve module\n", id); |
2006 | return -1; | 2004 | return -1; |
2007 | } | 2005 | } |
2008 | if (!(card = (capidrv_contr *) kmalloc(sizeof(capidrv_contr), GFP_ATOMIC))) { | 2006 | if (!(card = kzalloc(sizeof(capidrv_contr), GFP_ATOMIC))) { |
2009 | printk(KERN_WARNING | 2007 | printk(KERN_WARNING |
2010 | "capidrv: (%s) Could not allocate contr-struct.\n", id); | 2008 | "capidrv: (%s) Could not allocate contr-struct.\n", id); |
2011 | return -1; | 2009 | return -1; |
2012 | } | 2010 | } |
2013 | memset(card, 0, sizeof(capidrv_contr)); | ||
2014 | card->owner = THIS_MODULE; | 2011 | card->owner = THIS_MODULE; |
2015 | init_timer(&card->listentimer); | 2012 | init_timer(&card->listentimer); |
2016 | strcpy(card->name, id); | 2013 | strcpy(card->name, id); |
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index fd5d7364a487..eba10466ccc6 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c | |||
@@ -121,10 +121,9 @@ static int avmcs_probe(struct pcmcia_device *p_dev) | |||
121 | p_dev->conf.Present = PRESENT_OPTION; | 121 | p_dev->conf.Present = PRESENT_OPTION; |
122 | 122 | ||
123 | /* Allocate space for private device-specific data */ | 123 | /* Allocate space for private device-specific data */ |
124 | local = kmalloc(sizeof(local_info_t), GFP_KERNEL); | 124 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
125 | if (!local) | 125 | if (!local) |
126 | goto err; | 126 | goto err; |
127 | memset(local, 0, sizeof(local_info_t)); | ||
128 | p_dev->priv = local; | 127 | p_dev->priv = local; |
129 | 128 | ||
130 | return avmcs_config(p_dev); | 129 | return avmcs_config(p_dev); |
diff --git a/drivers/isdn/hardware/avm/b1.c b/drivers/isdn/hardware/avm/b1.c index da2729247713..7a69a18d07e2 100644 --- a/drivers/isdn/hardware/avm/b1.c +++ b/drivers/isdn/hardware/avm/b1.c | |||
@@ -65,18 +65,15 @@ avmcard *b1_alloc_card(int nr_controllers) | |||
65 | avmctrl_info *cinfo; | 65 | avmctrl_info *cinfo; |
66 | int i; | 66 | int i; |
67 | 67 | ||
68 | card = kmalloc(sizeof(*card), GFP_KERNEL); | 68 | card = kzalloc(sizeof(*card), GFP_KERNEL); |
69 | if (!card) | 69 | if (!card) |
70 | return NULL; | 70 | return NULL; |
71 | 71 | ||
72 | memset(card, 0, sizeof(*card)); | 72 | cinfo = kzalloc(sizeof(*cinfo) * nr_controllers, GFP_KERNEL); |
73 | |||
74 | cinfo = kmalloc(sizeof(*cinfo) * nr_controllers, GFP_KERNEL); | ||
75 | if (!cinfo) { | 73 | if (!cinfo) { |
76 | kfree(card); | 74 | kfree(card); |
77 | return NULL; | 75 | return NULL; |
78 | } | 76 | } |
79 | memset(cinfo, 0, sizeof(*cinfo) * nr_controllers); | ||
80 | 77 | ||
81 | card->ctrlinfo = cinfo; | 78 | card->ctrlinfo = cinfo; |
82 | for (i = 0; i < nr_controllers; i++) { | 79 | for (i = 0; i < nr_controllers; i++) { |
@@ -718,12 +715,11 @@ avmcard_dma_alloc(char *name, struct pci_dev *pdev, long rsize, long ssize) | |||
718 | avmcard_dmainfo *p; | 715 | avmcard_dmainfo *p; |
719 | void *buf; | 716 | void *buf; |
720 | 717 | ||
721 | p = kmalloc(sizeof(avmcard_dmainfo), GFP_KERNEL); | 718 | p = kzalloc(sizeof(avmcard_dmainfo), GFP_KERNEL); |
722 | if (!p) { | 719 | if (!p) { |
723 | printk(KERN_WARNING "%s: no memory.\n", name); | 720 | printk(KERN_WARNING "%s: no memory.\n", name); |
724 | goto err; | 721 | goto err; |
725 | } | 722 | } |
726 | memset(p, 0, sizeof(avmcard_dmainfo)); | ||
727 | 723 | ||
728 | p->recvbuf.size = rsize; | 724 | p->recvbuf.size = rsize; |
729 | buf = pci_alloc_consistent(pdev, rsize, &p->recvbuf.dmaaddr); | 725 | buf = pci_alloc_consistent(pdev, rsize, &p->recvbuf.dmaaddr); |
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index 876fec6c6be8..9e70c206779e 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c | |||
@@ -123,11 +123,10 @@ static int avma1cs_probe(struct pcmcia_device *p_dev) | |||
123 | DEBUG(0, "avma1cs_attach()\n"); | 123 | DEBUG(0, "avma1cs_attach()\n"); |
124 | 124 | ||
125 | /* Allocate space for private device-specific data */ | 125 | /* Allocate space for private device-specific data */ |
126 | local = kmalloc(sizeof(local_info_t), GFP_KERNEL); | 126 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
127 | if (!local) | 127 | if (!local) |
128 | return -ENOMEM; | 128 | return -ENOMEM; |
129 | 129 | ||
130 | memset(local, 0, sizeof(local_info_t)); | ||
131 | p_dev->priv = local; | 130 | p_dev->priv = local; |
132 | 131 | ||
133 | /* The io structure describes IO port mapping */ | 132 | /* The io structure describes IO port mapping */ |
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c index cede72cdbb31..9d6b7b0f6746 100644 --- a/drivers/isdn/hisax/config.c +++ b/drivers/isdn/hisax/config.c | |||
@@ -869,14 +869,13 @@ static int checkcard(int cardnr, char *id, int *busy_flag, struct module *lockow | |||
869 | struct IsdnCard *card = cards + cardnr; | 869 | struct IsdnCard *card = cards + cardnr; |
870 | struct IsdnCardState *cs; | 870 | struct IsdnCardState *cs; |
871 | 871 | ||
872 | cs = kmalloc(sizeof(struct IsdnCardState), GFP_ATOMIC); | 872 | cs = kzalloc(sizeof(struct IsdnCardState), GFP_ATOMIC); |
873 | if (!cs) { | 873 | if (!cs) { |
874 | printk(KERN_WARNING | 874 | printk(KERN_WARNING |
875 | "HiSax: No memory for IsdnCardState(card %d)\n", | 875 | "HiSax: No memory for IsdnCardState(card %d)\n", |
876 | cardnr + 1); | 876 | cardnr + 1); |
877 | goto out; | 877 | goto out; |
878 | } | 878 | } |
879 | memset(cs, 0, sizeof(struct IsdnCardState)); | ||
880 | card->cs = cs; | 879 | card->cs = cs; |
881 | spin_lock_init(&cs->statlock); | 880 | spin_lock_init(&cs->statlock); |
882 | spin_lock_init(&cs->lock); | 881 | spin_lock_init(&cs->lock); |
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index 4e180d210faa..79ab9dda7d08 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c | |||
@@ -146,9 +146,8 @@ static int elsa_cs_probe(struct pcmcia_device *link) | |||
146 | DEBUG(0, "elsa_cs_attach()\n"); | 146 | DEBUG(0, "elsa_cs_attach()\n"); |
147 | 147 | ||
148 | /* Allocate space for private device-specific data */ | 148 | /* Allocate space for private device-specific data */ |
149 | local = kmalloc(sizeof(local_info_t), GFP_KERNEL); | 149 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
150 | if (!local) return -ENOMEM; | 150 | if (!local) return -ENOMEM; |
151 | memset(local, 0, sizeof(local_info_t)); | ||
152 | 151 | ||
153 | local->p_dev = link; | 152 | local->p_dev = link; |
154 | link->priv = local; | 153 | link->priv = local; |
diff --git a/drivers/isdn/hisax/fsm.c b/drivers/isdn/hisax/fsm.c index 0d44a3f480ac..34fade96a581 100644 --- a/drivers/isdn/hisax/fsm.c +++ b/drivers/isdn/hisax/fsm.c | |||
@@ -26,12 +26,10 @@ FsmNew(struct Fsm *fsm, struct FsmNode *fnlist, int fncount) | |||
26 | int i; | 26 | int i; |
27 | 27 | ||
28 | fsm->jumpmatrix = (FSMFNPTR *) | 28 | fsm->jumpmatrix = (FSMFNPTR *) |
29 | kmalloc(sizeof (FSMFNPTR) * fsm->state_count * fsm->event_count, GFP_KERNEL); | 29 | kzalloc(sizeof (FSMFNPTR) * fsm->state_count * fsm->event_count, GFP_KERNEL); |
30 | if (!fsm->jumpmatrix) | 30 | if (!fsm->jumpmatrix) |
31 | return -ENOMEM; | 31 | return -ENOMEM; |
32 | 32 | ||
33 | memset(fsm->jumpmatrix, 0, sizeof (FSMFNPTR) * fsm->state_count * fsm->event_count); | ||
34 | |||
35 | for (i = 0; i < fncount; i++) | 33 | for (i = 0; i < fncount; i++) |
36 | if ((fnlist[i].state>=fsm->state_count) || (fnlist[i].event>=fsm->event_count)) { | 34 | if ((fnlist[i].state>=fsm->state_count) || (fnlist[i].event>=fsm->event_count)) { |
37 | printk(KERN_ERR "FsmNew Error line %d st(%ld/%ld) ev(%ld/%ld)\n", | 35 | printk(KERN_ERR "FsmNew Error line %d st(%ld/%ld) ev(%ld/%ld)\n", |
diff --git a/drivers/isdn/hisax/hfc4s8s_l1.c b/drivers/isdn/hisax/hfc4s8s_l1.c index de9b1a4d6bac..a2fa4ecb8c88 100644 --- a/drivers/isdn/hisax/hfc4s8s_l1.c +++ b/drivers/isdn/hisax/hfc4s8s_l1.c | |||
@@ -1591,11 +1591,10 @@ hfc4s8s_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1591 | hfc4s8s_param *driver_data = (hfc4s8s_param *) ent->driver_data; | 1591 | hfc4s8s_param *driver_data = (hfc4s8s_param *) ent->driver_data; |
1592 | hfc4s8s_hw *hw; | 1592 | hfc4s8s_hw *hw; |
1593 | 1593 | ||
1594 | if (!(hw = kmalloc(sizeof(hfc4s8s_hw), GFP_ATOMIC))) { | 1594 | if (!(hw = kzalloc(sizeof(hfc4s8s_hw), GFP_ATOMIC))) { |
1595 | printk(KERN_ERR "No kmem for HFC-4S/8S card\n"); | 1595 | printk(KERN_ERR "No kmem for HFC-4S/8S card\n"); |
1596 | return (err); | 1596 | return (err); |
1597 | } | 1597 | } |
1598 | memset(hw, 0, sizeof(hfc4s8s_hw)); | ||
1599 | 1598 | ||
1600 | hw->pdev = pdev; | 1599 | hw->pdev = pdev; |
1601 | err = pci_enable_device(pdev); | 1600 | err = pci_enable_device(pdev); |
diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c index 7105b043add8..5a6989f23fcf 100644 --- a/drivers/isdn/hisax/hfc_usb.c +++ b/drivers/isdn/hisax/hfc_usb.c | |||
@@ -1481,9 +1481,8 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1481 | iface = iface_used; | 1481 | iface = iface_used; |
1482 | if (! | 1482 | if (! |
1483 | (context = | 1483 | (context = |
1484 | kmalloc(sizeof(hfcusb_data), GFP_KERNEL))) | 1484 | kzalloc(sizeof(hfcusb_data), GFP_KERNEL))) |
1485 | return (-ENOMEM); /* got no mem */ | 1485 | return (-ENOMEM); /* got no mem */ |
1486 | memset(context, 0, sizeof(hfcusb_data)); | ||
1487 | 1486 | ||
1488 | ep = iface->endpoint; | 1487 | ep = iface->endpoint; |
1489 | vcf = validconf[small_match]; | 1488 | vcf = validconf[small_match]; |
diff --git a/drivers/isdn/hisax/hisax_fcpcipnp.c b/drivers/isdn/hisax/hisax_fcpcipnp.c index f6db55a752c4..9e088fce8c3a 100644 --- a/drivers/isdn/hisax/hisax_fcpcipnp.c +++ b/drivers/isdn/hisax/hisax_fcpcipnp.c | |||
@@ -841,12 +841,10 @@ new_adapter(void) | |||
841 | struct hisax_b_if *b_if[2]; | 841 | struct hisax_b_if *b_if[2]; |
842 | int i; | 842 | int i; |
843 | 843 | ||
844 | adapter = kmalloc(sizeof(struct fritz_adapter), GFP_KERNEL); | 844 | adapter = kzalloc(sizeof(struct fritz_adapter), GFP_KERNEL); |
845 | if (!adapter) | 845 | if (!adapter) |
846 | return NULL; | 846 | return NULL; |
847 | 847 | ||
848 | memset(adapter, 0, sizeof(struct fritz_adapter)); | ||
849 | |||
850 | adapter->isac.hisax_d_if.owner = THIS_MODULE; | 848 | adapter->isac.hisax_d_if.owner = THIS_MODULE; |
851 | adapter->isac.hisax_d_if.ifc.priv = &adapter->isac; | 849 | adapter->isac.hisax_d_if.ifc.priv = &adapter->isac; |
852 | adapter->isac.hisax_d_if.ifc.l2l1 = isac_d_l2l1; | 850 | adapter->isac.hisax_d_if.ifc.l2l1 = isac_d_l2l1; |
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index 46ed65334c51..45debde05fbd 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c | |||
@@ -155,9 +155,8 @@ static int sedlbauer_probe(struct pcmcia_device *link) | |||
155 | DEBUG(0, "sedlbauer_attach()\n"); | 155 | DEBUG(0, "sedlbauer_attach()\n"); |
156 | 156 | ||
157 | /* Allocate space for private device-specific data */ | 157 | /* Allocate space for private device-specific data */ |
158 | local = kmalloc(sizeof(local_info_t), GFP_KERNEL); | 158 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
159 | if (!local) return -ENOMEM; | 159 | if (!local) return -ENOMEM; |
160 | memset(local, 0, sizeof(local_info_t)); | ||
161 | local->cardnr = -1; | 160 | local->cardnr = -1; |
162 | 161 | ||
163 | local->p_dev = link; | 162 | local->p_dev = link; |
diff --git a/drivers/isdn/hisax/st5481_init.c b/drivers/isdn/hisax/st5481_init.c index 2716aa5c60f7..bb3a28a53ff4 100644 --- a/drivers/isdn/hisax/st5481_init.c +++ b/drivers/isdn/hisax/st5481_init.c | |||
@@ -69,12 +69,10 @@ static int probe_st5481(struct usb_interface *intf, | |||
69 | le16_to_cpu(dev->descriptor.idProduct), | 69 | le16_to_cpu(dev->descriptor.idProduct), |
70 | number_of_leds); | 70 | number_of_leds); |
71 | 71 | ||
72 | adapter = kmalloc(sizeof(struct st5481_adapter), GFP_KERNEL); | 72 | adapter = kzalloc(sizeof(struct st5481_adapter), GFP_KERNEL); |
73 | if (!adapter) | 73 | if (!adapter) |
74 | return -ENOMEM; | 74 | return -ENOMEM; |
75 | 75 | ||
76 | memset(adapter, 0, sizeof(struct st5481_adapter)); | ||
77 | |||
78 | adapter->number_of_leds = number_of_leds; | 76 | adapter->number_of_leds = number_of_leds; |
79 | adapter->usb_dev = dev; | 77 | adapter->usb_dev = dev; |
80 | 78 | ||
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index 6b754f183796..3e3e18239ec7 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c | |||
@@ -137,9 +137,8 @@ static int teles_probe(struct pcmcia_device *link) | |||
137 | DEBUG(0, "teles_attach()\n"); | 137 | DEBUG(0, "teles_attach()\n"); |
138 | 138 | ||
139 | /* Allocate space for private device-specific data */ | 139 | /* Allocate space for private device-specific data */ |
140 | local = kmalloc(sizeof(local_info_t), GFP_KERNEL); | 140 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
141 | if (!local) return -ENOMEM; | 141 | if (!local) return -ENOMEM; |
142 | memset(local, 0, sizeof(local_info_t)); | ||
143 | local->cardnr = -1; | 142 | local->cardnr = -1; |
144 | 143 | ||
145 | local->p_dev = link; | 144 | local->p_dev = link; |
diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c index 6bac43cc91bd..b2ae4ec1e49e 100644 --- a/drivers/isdn/hysdn/hycapi.c +++ b/drivers/isdn/hysdn/hycapi.c | |||
@@ -745,12 +745,11 @@ hycapi_capi_create(hysdn_card *card) | |||
745 | return 1; | 745 | return 1; |
746 | } | 746 | } |
747 | if (!card->hyctrlinfo) { | 747 | if (!card->hyctrlinfo) { |
748 | cinfo = (hycapictrl_info *) kmalloc(sizeof(hycapictrl_info), GFP_ATOMIC); | 748 | cinfo = kzalloc(sizeof(hycapictrl_info), GFP_ATOMIC); |
749 | if (!cinfo) { | 749 | if (!cinfo) { |
750 | printk(KERN_WARNING "HYSDN: no memory for capi-ctrl.\n"); | 750 | printk(KERN_WARNING "HYSDN: no memory for capi-ctrl.\n"); |
751 | return -ENOMEM; | 751 | return -ENOMEM; |
752 | } | 752 | } |
753 | memset(cinfo, 0, sizeof(hycapictrl_info)); | ||
754 | card->hyctrlinfo = cinfo; | 753 | card->hyctrlinfo = cinfo; |
755 | cinfo->card = card; | 754 | cinfo->card = card; |
756 | spin_lock_init(&cinfo->lock); | 755 | spin_lock_init(&cinfo->lock); |
diff --git a/drivers/isdn/hysdn/hysdn_boot.c b/drivers/isdn/hysdn/hysdn_boot.c index 6d0eb0f42fca..be787e16bb79 100644 --- a/drivers/isdn/hysdn/hysdn_boot.c +++ b/drivers/isdn/hysdn/hysdn_boot.c | |||
@@ -278,14 +278,13 @@ pof_write_open(hysdn_card * card, unsigned char **bufp) | |||
278 | return (-ERR_ALREADY_BOOT); /* boot already active */ | 278 | return (-ERR_ALREADY_BOOT); /* boot already active */ |
279 | } | 279 | } |
280 | /* error no mem available */ | 280 | /* error no mem available */ |
281 | if (!(boot = kmalloc(sizeof(struct boot_data), GFP_KERNEL))) { | 281 | if (!(boot = kzalloc(sizeof(struct boot_data), GFP_KERNEL))) { |
282 | if (card->debug_flags & LOG_MEM_ERR) | 282 | if (card->debug_flags & LOG_MEM_ERR) |
283 | hysdn_addlog(card, "POF open: unable to allocate mem"); | 283 | hysdn_addlog(card, "POF open: unable to allocate mem"); |
284 | return (-EFAULT); | 284 | return (-EFAULT); |
285 | } | 285 | } |
286 | card->boot = boot; | 286 | card->boot = boot; |
287 | card->state = CARD_STATE_BOOTING; | 287 | card->state = CARD_STATE_BOOTING; |
288 | memset(boot, 0, sizeof(struct boot_data)); | ||
289 | 288 | ||
290 | card->stopcard(card); /* first stop the card */ | 289 | card->stopcard(card); /* first stop the card */ |
291 | if (card->testram(card)) { | 290 | if (card->testram(card)) { |
diff --git a/drivers/isdn/hysdn/hysdn_init.c b/drivers/isdn/hysdn/hysdn_init.c index b702ed27252b..9e01748a176e 100644 --- a/drivers/isdn/hysdn/hysdn_init.c +++ b/drivers/isdn/hysdn/hysdn_init.c | |||
@@ -81,11 +81,10 @@ search_cards(void) | |||
81 | if (pci_enable_device(akt_pcidev)) | 81 | if (pci_enable_device(akt_pcidev)) |
82 | continue; | 82 | continue; |
83 | 83 | ||
84 | if (!(card = kmalloc(sizeof(hysdn_card), GFP_KERNEL))) { | 84 | if (!(card = kzalloc(sizeof(hysdn_card), GFP_KERNEL))) { |
85 | printk(KERN_ERR "HYSDN: unable to alloc device mem \n"); | 85 | printk(KERN_ERR "HYSDN: unable to alloc device mem \n"); |
86 | return; | 86 | return; |
87 | } | 87 | } |
88 | memset(card, 0, sizeof(hysdn_card)); | ||
89 | card->myid = cardmax; /* set own id */ | 88 | card->myid = cardmax; /* set own id */ |
90 | card->bus = akt_pcidev->bus->number; | 89 | card->bus = akt_pcidev->bus->number; |
91 | card->devfn = akt_pcidev->devfn; /* slot + function */ | 90 | card->devfn = akt_pcidev->devfn; /* slot + function */ |
diff --git a/drivers/isdn/hysdn/hysdn_net.c b/drivers/isdn/hysdn/hysdn_net.c index d205249a1242..557d96c78a62 100644 --- a/drivers/isdn/hysdn/hysdn_net.c +++ b/drivers/isdn/hysdn/hysdn_net.c | |||
@@ -278,11 +278,10 @@ hysdn_net_create(hysdn_card * card) | |||
278 | return (-ENOMEM); | 278 | return (-ENOMEM); |
279 | } | 279 | } |
280 | hysdn_net_release(card); /* release an existing net device */ | 280 | hysdn_net_release(card); /* release an existing net device */ |
281 | if ((dev = kmalloc(sizeof(struct net_local), GFP_KERNEL)) == NULL) { | 281 | if ((dev = kzalloc(sizeof(struct net_local), GFP_KERNEL)) == NULL) { |
282 | printk(KERN_WARNING "HYSDN: unable to allocate mem\n"); | 282 | printk(KERN_WARNING "HYSDN: unable to allocate mem\n"); |
283 | return (-ENOMEM); | 283 | return (-ENOMEM); |
284 | } | 284 | } |
285 | memset(dev, 0, sizeof(struct net_local)); /* clean the structure */ | ||
286 | 285 | ||
287 | spin_lock_init(&((struct net_local *) dev)->lock); | 286 | spin_lock_init(&((struct net_local *) dev)->lock); |
288 | 287 | ||
diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c index 4d238eff1773..f241f5e551cb 100644 --- a/drivers/isdn/hysdn/hysdn_proclog.c +++ b/drivers/isdn/hysdn/hysdn_proclog.c | |||
@@ -405,8 +405,7 @@ hysdn_proclog_init(hysdn_card * card) | |||
405 | 405 | ||
406 | /* create a cardlog proc entry */ | 406 | /* create a cardlog proc entry */ |
407 | 407 | ||
408 | if ((pd = (struct procdata *) kmalloc(sizeof(struct procdata), GFP_KERNEL)) != NULL) { | 408 | if ((pd = kzalloc(sizeof(struct procdata), GFP_KERNEL)) != NULL) { |
409 | memset(pd, 0, sizeof(struct procdata)); | ||
410 | sprintf(pd->log_name, "%s%d", PROC_LOG_BASENAME, card->myid); | 409 | sprintf(pd->log_name, "%s%d", PROC_LOG_BASENAME, card->myid); |
411 | if ((pd->log = create_proc_entry(pd->log_name, S_IFREG | S_IRUGO | S_IWUSR, hysdn_proc_entry)) != NULL) { | 410 | if ((pd->log = create_proc_entry(pd->log_name, S_IFREG | S_IRUGO | S_IWUSR, hysdn_proc_entry)) != NULL) { |
412 | pd->log->proc_fops = &log_fops; | 411 | pd->log->proc_fops = &log_fops; |
diff --git a/drivers/isdn/i4l/isdn_bsdcomp.c b/drivers/isdn/i4l/isdn_bsdcomp.c index 0afe442db3b0..a20f33b4a220 100644 --- a/drivers/isdn/i4l/isdn_bsdcomp.c +++ b/drivers/isdn/i4l/isdn_bsdcomp.c | |||
@@ -331,12 +331,10 @@ static void *bsd_alloc (struct isdn_ppp_comp_data *data) | |||
331 | * Allocate the main control structure for this instance. | 331 | * Allocate the main control structure for this instance. |
332 | */ | 332 | */ |
333 | maxmaxcode = MAXCODE(bits); | 333 | maxmaxcode = MAXCODE(bits); |
334 | db = (struct bsd_db *) kmalloc (sizeof (struct bsd_db),GFP_KERNEL); | 334 | db = kzalloc (sizeof (struct bsd_db),GFP_KERNEL); |
335 | if (!db) | 335 | if (!db) |
336 | return NULL; | 336 | return NULL; |
337 | 337 | ||
338 | memset (db, 0, sizeof(struct bsd_db)); | ||
339 | |||
340 | db->xmit = data->flags & IPPP_COMP_FLAG_XMIT; | 338 | db->xmit = data->flags & IPPP_COMP_FLAG_XMIT; |
341 | decomp = db->xmit ? 0 : 1; | 339 | decomp = db->xmit ? 0 : 1; |
342 | 340 | ||
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c index a610a05aa217..6a2ef0a87ed9 100644 --- a/drivers/isdn/i4l/isdn_common.c +++ b/drivers/isdn/i4l/isdn_common.c | |||
@@ -2072,21 +2072,19 @@ isdn_add_channels(isdn_driver_t *d, int drvidx, int n, int adding) | |||
2072 | 2072 | ||
2073 | if ((adding) && (d->rcverr)) | 2073 | if ((adding) && (d->rcverr)) |
2074 | kfree(d->rcverr); | 2074 | kfree(d->rcverr); |
2075 | if (!(d->rcverr = kmalloc(sizeof(int) * m, GFP_ATOMIC))) { | 2075 | if (!(d->rcverr = kzalloc(sizeof(int) * m, GFP_ATOMIC))) { |
2076 | printk(KERN_WARNING "register_isdn: Could not alloc rcverr\n"); | 2076 | printk(KERN_WARNING "register_isdn: Could not alloc rcverr\n"); |
2077 | return -1; | 2077 | return -1; |
2078 | } | 2078 | } |
2079 | memset((char *) d->rcverr, 0, sizeof(int) * m); | ||
2080 | 2079 | ||
2081 | if ((adding) && (d->rcvcount)) | 2080 | if ((adding) && (d->rcvcount)) |
2082 | kfree(d->rcvcount); | 2081 | kfree(d->rcvcount); |
2083 | if (!(d->rcvcount = kmalloc(sizeof(int) * m, GFP_ATOMIC))) { | 2082 | if (!(d->rcvcount = kzalloc(sizeof(int) * m, GFP_ATOMIC))) { |
2084 | printk(KERN_WARNING "register_isdn: Could not alloc rcvcount\n"); | 2083 | printk(KERN_WARNING "register_isdn: Could not alloc rcvcount\n"); |
2085 | if (!adding) | 2084 | if (!adding) |
2086 | kfree(d->rcverr); | 2085 | kfree(d->rcverr); |
2087 | return -1; | 2086 | return -1; |
2088 | } | 2087 | } |
2089 | memset((char *) d->rcvcount, 0, sizeof(int) * m); | ||
2090 | 2088 | ||
2091 | if ((adding) && (d->rpqueue)) { | 2089 | if ((adding) && (d->rpqueue)) { |
2092 | for (j = 0; j < d->channels; j++) | 2090 | for (j = 0; j < d->channels; j++) |
@@ -2226,11 +2224,10 @@ register_isdn(isdn_if * i) | |||
2226 | printk(KERN_WARNING "register_isdn: No write routine given.\n"); | 2224 | printk(KERN_WARNING "register_isdn: No write routine given.\n"); |
2227 | return 0; | 2225 | return 0; |
2228 | } | 2226 | } |
2229 | if (!(d = kmalloc(sizeof(isdn_driver_t), GFP_KERNEL))) { | 2227 | if (!(d = kzalloc(sizeof(isdn_driver_t), GFP_KERNEL))) { |
2230 | printk(KERN_WARNING "register_isdn: Could not alloc driver-struct\n"); | 2228 | printk(KERN_WARNING "register_isdn: Could not alloc driver-struct\n"); |
2231 | return 0; | 2229 | return 0; |
2232 | } | 2230 | } |
2233 | memset((char *) d, 0, sizeof(isdn_driver_t)); | ||
2234 | 2231 | ||
2235 | d->maxbufsize = i->maxbufsize; | 2232 | d->maxbufsize = i->maxbufsize; |
2236 | d->pktcount = 0; | 2233 | d->pktcount = 0; |
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index 2e4daebfb7e0..c36c817578cb 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c | |||
@@ -2542,17 +2542,15 @@ isdn_net_new(char *name, struct net_device *master) | |||
2542 | printk(KERN_WARNING "isdn_net: interface %s already exists\n", name); | 2542 | printk(KERN_WARNING "isdn_net: interface %s already exists\n", name); |
2543 | return NULL; | 2543 | return NULL; |
2544 | } | 2544 | } |
2545 | if (!(netdev = (isdn_net_dev *) kmalloc(sizeof(isdn_net_dev), GFP_KERNEL))) { | 2545 | if (!(netdev = kzalloc(sizeof(isdn_net_dev), GFP_KERNEL))) { |
2546 | printk(KERN_WARNING "isdn_net: Could not allocate net-device\n"); | 2546 | printk(KERN_WARNING "isdn_net: Could not allocate net-device\n"); |
2547 | return NULL; | 2547 | return NULL; |
2548 | } | 2548 | } |
2549 | memset(netdev, 0, sizeof(isdn_net_dev)); | 2549 | if (!(netdev->local = kzalloc(sizeof(isdn_net_local), GFP_KERNEL))) { |
2550 | if (!(netdev->local = (isdn_net_local *) kmalloc(sizeof(isdn_net_local), GFP_KERNEL))) { | ||
2551 | printk(KERN_WARNING "isdn_net: Could not allocate device locals\n"); | 2550 | printk(KERN_WARNING "isdn_net: Could not allocate device locals\n"); |
2552 | kfree(netdev); | 2551 | kfree(netdev); |
2553 | return NULL; | 2552 | return NULL; |
2554 | } | 2553 | } |
2555 | memset(netdev->local, 0, sizeof(isdn_net_local)); | ||
2556 | if (name == NULL) | 2554 | if (name == NULL) |
2557 | strcpy(netdev->local->name, " "); | 2555 | strcpy(netdev->local->name, " "); |
2558 | else | 2556 | else |
diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c index 26e46720fc1c..43811795b46b 100644 --- a/drivers/isdn/i4l/isdn_ppp.c +++ b/drivers/isdn/i4l/isdn_ppp.c | |||
@@ -876,14 +876,12 @@ isdn_ppp_init(void) | |||
876 | #endif /* CONFIG_ISDN_MPP */ | 876 | #endif /* CONFIG_ISDN_MPP */ |
877 | 877 | ||
878 | for (i = 0; i < ISDN_MAX_CHANNELS; i++) { | 878 | for (i = 0; i < ISDN_MAX_CHANNELS; i++) { |
879 | if (!(ippp_table[i] = (struct ippp_struct *) | 879 | if (!(ippp_table[i] = kzalloc(sizeof(struct ippp_struct), GFP_KERNEL))) { |
880 | kmalloc(sizeof(struct ippp_struct), GFP_KERNEL))) { | ||
881 | printk(KERN_WARNING "isdn_ppp_init: Could not alloc ippp_table\n"); | 880 | printk(KERN_WARNING "isdn_ppp_init: Could not alloc ippp_table\n"); |
882 | for (j = 0; j < i; j++) | 881 | for (j = 0; j < i; j++) |
883 | kfree(ippp_table[j]); | 882 | kfree(ippp_table[j]); |
884 | return -1; | 883 | return -1; |
885 | } | 884 | } |
886 | memset((char *) ippp_table[i], 0, sizeof(struct ippp_struct)); | ||
887 | spin_lock_init(&ippp_table[i]->buflock); | 885 | spin_lock_init(&ippp_table[i]->buflock); |
888 | ippp_table[i]->state = 0; | 886 | ippp_table[i]->state = 0; |
889 | ippp_table[i]->first = ippp_table[i]->rq + NUM_RCV_BUFFS - 1; | 887 | ippp_table[i]->first = ippp_table[i]->rq + NUM_RCV_BUFFS - 1; |
@@ -1529,10 +1527,8 @@ static int isdn_ppp_mp_bundle_array_init(void) | |||
1529 | { | 1527 | { |
1530 | int i; | 1528 | int i; |
1531 | int sz = ISDN_MAX_CHANNELS*sizeof(ippp_bundle); | 1529 | int sz = ISDN_MAX_CHANNELS*sizeof(ippp_bundle); |
1532 | if( (isdn_ppp_bundle_arr = (ippp_bundle*)kmalloc(sz, | 1530 | if( (isdn_ppp_bundle_arr = kzalloc(sz, GFP_KERNEL)) == NULL ) |
1533 | GFP_KERNEL)) == NULL ) | ||
1534 | return -ENOMEM; | 1531 | return -ENOMEM; |
1535 | memset(isdn_ppp_bundle_arr, 0, sz); | ||
1536 | for( i = 0; i < ISDN_MAX_CHANNELS; i++ ) | 1532 | for( i = 0; i < ISDN_MAX_CHANNELS; i++ ) |
1537 | spin_lock_init(&isdn_ppp_bundle_arr[i].lock); | 1533 | spin_lock_init(&isdn_ppp_bundle_arr[i].lock); |
1538 | return 0; | 1534 | return 0; |
@@ -2246,13 +2242,12 @@ static void isdn_ppp_ccp_xmit_reset(struct ippp_struct *is, int proto, | |||
2246 | static struct ippp_ccp_reset *isdn_ppp_ccp_reset_alloc(struct ippp_struct *is) | 2242 | static struct ippp_ccp_reset *isdn_ppp_ccp_reset_alloc(struct ippp_struct *is) |
2247 | { | 2243 | { |
2248 | struct ippp_ccp_reset *r; | 2244 | struct ippp_ccp_reset *r; |
2249 | r = kmalloc(sizeof(struct ippp_ccp_reset), GFP_KERNEL); | 2245 | r = kzalloc(sizeof(struct ippp_ccp_reset), GFP_KERNEL); |
2250 | if(!r) { | 2246 | if(!r) { |
2251 | printk(KERN_ERR "ippp_ccp: failed to allocate reset data" | 2247 | printk(KERN_ERR "ippp_ccp: failed to allocate reset data" |
2252 | " structure - no mem\n"); | 2248 | " structure - no mem\n"); |
2253 | return NULL; | 2249 | return NULL; |
2254 | } | 2250 | } |
2255 | memset(r, 0, sizeof(struct ippp_ccp_reset)); | ||
2256 | printk(KERN_DEBUG "ippp_ccp: allocated reset data structure %p\n", r); | 2251 | printk(KERN_DEBUG "ippp_ccp: allocated reset data structure %p\n", r); |
2257 | is->reset = r; | 2252 | is->reset = r; |
2258 | return r; | 2253 | return r; |
@@ -2338,10 +2333,9 @@ static struct ippp_ccp_reset_state *isdn_ppp_ccp_reset_alloc_state(struct ippp_s | |||
2338 | id); | 2333 | id); |
2339 | return NULL; | 2334 | return NULL; |
2340 | } else { | 2335 | } else { |
2341 | rs = kmalloc(sizeof(struct ippp_ccp_reset_state), GFP_KERNEL); | 2336 | rs = kzalloc(sizeof(struct ippp_ccp_reset_state), GFP_KERNEL); |
2342 | if(!rs) | 2337 | if(!rs) |
2343 | return NULL; | 2338 | return NULL; |
2344 | memset(rs, 0, sizeof(struct ippp_ccp_reset_state)); | ||
2345 | rs->state = CCPResetIdle; | 2339 | rs->state = CCPResetIdle; |
2346 | rs->is = is; | 2340 | rs->is = is; |
2347 | rs->id = id; | 2341 | rs->id = id; |
diff --git a/drivers/isdn/i4l/isdn_v110.c b/drivers/isdn/i4l/isdn_v110.c index 38619e8cd823..5484d3c38a57 100644 --- a/drivers/isdn/i4l/isdn_v110.c +++ b/drivers/isdn/i4l/isdn_v110.c | |||
@@ -92,9 +92,8 @@ isdn_v110_open(unsigned char key, int hdrlen, int maxsize) | |||
92 | int i; | 92 | int i; |
93 | isdn_v110_stream *v; | 93 | isdn_v110_stream *v; |
94 | 94 | ||
95 | if ((v = kmalloc(sizeof(isdn_v110_stream), GFP_ATOMIC)) == NULL) | 95 | if ((v = kzalloc(sizeof(isdn_v110_stream), GFP_ATOMIC)) == NULL) |
96 | return NULL; | 96 | return NULL; |
97 | memset(v, 0, sizeof(isdn_v110_stream)); | ||
98 | v->key = key; | 97 | v->key = key; |
99 | v->nbits = 0; | 98 | v->nbits = 0; |
100 | for (i = 0; key & (1 << i); i++) | 99 | for (i = 0; key & (1 << i); i++) |
diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c index 730bbd07ebc7..1e699bcaba0f 100644 --- a/drivers/isdn/icn/icn.c +++ b/drivers/isdn/icn/icn.c | |||
@@ -1519,12 +1519,11 @@ icn_initcard(int port, char *id) | |||
1519 | icn_card *card; | 1519 | icn_card *card; |
1520 | int i; | 1520 | int i; |
1521 | 1521 | ||
1522 | if (!(card = (icn_card *) kmalloc(sizeof(icn_card), GFP_KERNEL))) { | 1522 | if (!(card = kzalloc(sizeof(icn_card), GFP_KERNEL))) { |
1523 | printk(KERN_WARNING | 1523 | printk(KERN_WARNING |
1524 | "icn: (%s) Could not allocate card-struct.\n", id); | 1524 | "icn: (%s) Could not allocate card-struct.\n", id); |
1525 | return (icn_card *) 0; | 1525 | return (icn_card *) 0; |
1526 | } | 1526 | } |
1527 | memset((char *) card, 0, sizeof(icn_card)); | ||
1528 | spin_lock_init(&card->lock); | 1527 | spin_lock_init(&card->lock); |
1529 | card->port = port; | 1528 | card->port = port; |
1530 | card->interface.owner = THIS_MODULE; | 1529 | card->interface.owner = THIS_MODULE; |
diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c index c3ae2edaf6fa..e3add27dd0e1 100644 --- a/drivers/isdn/isdnloop/isdnloop.c +++ b/drivers/isdn/isdnloop/isdnloop.c | |||
@@ -1430,12 +1430,11 @@ isdnloop_initcard(char *id) | |||
1430 | isdnloop_card *card; | 1430 | isdnloop_card *card; |
1431 | int i; | 1431 | int i; |
1432 | 1432 | ||
1433 | if (!(card = (isdnloop_card *) kmalloc(sizeof(isdnloop_card), GFP_KERNEL))) { | 1433 | if (!(card = kzalloc(sizeof(isdnloop_card), GFP_KERNEL))) { |
1434 | printk(KERN_WARNING | 1434 | printk(KERN_WARNING |
1435 | "isdnloop: (%s) Could not allocate card-struct.\n", id); | 1435 | "isdnloop: (%s) Could not allocate card-struct.\n", id); |
1436 | return (isdnloop_card *) 0; | 1436 | return (isdnloop_card *) 0; |
1437 | } | 1437 | } |
1438 | memset((char *) card, 0, sizeof(isdnloop_card)); | ||
1439 | card->interface.owner = THIS_MODULE; | 1438 | card->interface.owner = THIS_MODULE; |
1440 | card->interface.channels = ISDNLOOP_BCH; | 1439 | card->interface.channels = ISDNLOOP_BCH; |
1441 | card->interface.hl_hdrlen = 1; /* scratch area for storing ack flag*/ | 1440 | card->interface.hl_hdrlen = 1; /* scratch area for storing ack flag*/ |
diff --git a/drivers/isdn/pcbit/drv.c b/drivers/isdn/pcbit/drv.c index 1966f3410a13..11c1b0b6e390 100644 --- a/drivers/isdn/pcbit/drv.c +++ b/drivers/isdn/pcbit/drv.c | |||
@@ -73,14 +73,13 @@ int pcbit_init_dev(int board, int mem_base, int irq) | |||
73 | struct pcbit_dev *dev; | 73 | struct pcbit_dev *dev; |
74 | isdn_if *dev_if; | 74 | isdn_if *dev_if; |
75 | 75 | ||
76 | if ((dev=kmalloc(sizeof(struct pcbit_dev), GFP_KERNEL)) == NULL) | 76 | if ((dev=kzalloc(sizeof(struct pcbit_dev), GFP_KERNEL)) == NULL) |
77 | { | 77 | { |
78 | printk("pcbit_init: couldn't malloc pcbit_dev struct\n"); | 78 | printk("pcbit_init: couldn't malloc pcbit_dev struct\n"); |
79 | return -ENOMEM; | 79 | return -ENOMEM; |
80 | } | 80 | } |
81 | 81 | ||
82 | dev_pcbit[board] = dev; | 82 | dev_pcbit[board] = dev; |
83 | memset(dev, 0, sizeof(struct pcbit_dev)); | ||
84 | init_waitqueue_head(&dev->set_running_wq); | 83 | init_waitqueue_head(&dev->set_running_wq); |
85 | spin_lock_init(&dev->lock); | 84 | spin_lock_init(&dev->lock); |
86 | 85 | ||
@@ -104,7 +103,7 @@ int pcbit_init_dev(int board, int mem_base, int irq) | |||
104 | return -EACCES; | 103 | return -EACCES; |
105 | } | 104 | } |
106 | 105 | ||
107 | dev->b1 = kmalloc(sizeof(struct pcbit_chan), GFP_KERNEL); | 106 | dev->b1 = kzalloc(sizeof(struct pcbit_chan), GFP_KERNEL); |
108 | if (!dev->b1) { | 107 | if (!dev->b1) { |
109 | printk("pcbit_init: couldn't malloc pcbit_chan struct\n"); | 108 | printk("pcbit_init: couldn't malloc pcbit_chan struct\n"); |
110 | iounmap(dev->sh_mem); | 109 | iounmap(dev->sh_mem); |
@@ -113,7 +112,7 @@ int pcbit_init_dev(int board, int mem_base, int irq) | |||
113 | return -ENOMEM; | 112 | return -ENOMEM; |
114 | } | 113 | } |
115 | 114 | ||
116 | dev->b2 = kmalloc(sizeof(struct pcbit_chan), GFP_KERNEL); | 115 | dev->b2 = kzalloc(sizeof(struct pcbit_chan), GFP_KERNEL); |
117 | if (!dev->b2) { | 116 | if (!dev->b2) { |
118 | printk("pcbit_init: couldn't malloc pcbit_chan struct\n"); | 117 | printk("pcbit_init: couldn't malloc pcbit_chan struct\n"); |
119 | kfree(dev->b1); | 118 | kfree(dev->b1); |
@@ -123,8 +122,6 @@ int pcbit_init_dev(int board, int mem_base, int irq) | |||
123 | return -ENOMEM; | 122 | return -ENOMEM; |
124 | } | 123 | } |
125 | 124 | ||
126 | memset(dev->b1, 0, sizeof(struct pcbit_chan)); | ||
127 | memset(dev->b2, 0, sizeof(struct pcbit_chan)); | ||
128 | dev->b2->id = 1; | 125 | dev->b2->id = 1; |
129 | 126 | ||
130 | INIT_WORK(&dev->qdelivery, pcbit_deliver); | 127 | INIT_WORK(&dev->qdelivery, pcbit_deliver); |
diff --git a/drivers/isdn/pcbit/layer2.c b/drivers/isdn/pcbit/layer2.c index 0c9f6df873fc..6ff85574e941 100644 --- a/drivers/isdn/pcbit/layer2.c +++ b/drivers/isdn/pcbit/layer2.c | |||
@@ -369,13 +369,12 @@ pcbit_receive(struct pcbit_dev *dev) | |||
369 | kfree(dev->read_frame); | 369 | kfree(dev->read_frame); |
370 | dev->read_frame = NULL; | 370 | dev->read_frame = NULL; |
371 | } | 371 | } |
372 | frame = kmalloc(sizeof(struct frame_buf), GFP_ATOMIC); | 372 | frame = kzalloc(sizeof(struct frame_buf), GFP_ATOMIC); |
373 | 373 | ||
374 | if (frame == NULL) { | 374 | if (frame == NULL) { |
375 | printk(KERN_WARNING "kmalloc failed\n"); | 375 | printk(KERN_WARNING "kmalloc failed\n"); |
376 | return; | 376 | return; |
377 | } | 377 | } |
378 | memset(frame, 0, sizeof(struct frame_buf)); | ||
379 | 378 | ||
380 | cpu = pcbit_readb(dev); | 379 | cpu = pcbit_readb(dev); |
381 | proc = pcbit_readb(dev); | 380 | proc = pcbit_readb(dev); |
diff --git a/drivers/isdn/sc/init.c b/drivers/isdn/sc/init.c index 06c9872e8c6a..150759a5cddf 100644 --- a/drivers/isdn/sc/init.c +++ b/drivers/isdn/sc/init.c | |||
@@ -271,14 +271,13 @@ static int __init sc_init(void) | |||
271 | * Horray! We found a board, Make sure we can register | 271 | * Horray! We found a board, Make sure we can register |
272 | * it with ISDN4Linux | 272 | * it with ISDN4Linux |
273 | */ | 273 | */ |
274 | interface = kmalloc(sizeof(isdn_if), GFP_KERNEL); | 274 | interface = kzalloc(sizeof(isdn_if), GFP_KERNEL); |
275 | if (interface == NULL) { | 275 | if (interface == NULL) { |
276 | /* | 276 | /* |
277 | * Oops, can't malloc isdn_if | 277 | * Oops, can't malloc isdn_if |
278 | */ | 278 | */ |
279 | continue; | 279 | continue; |
280 | } | 280 | } |
281 | memset(interface, 0, sizeof(isdn_if)); | ||
282 | 281 | ||
283 | interface->owner = THIS_MODULE; | 282 | interface->owner = THIS_MODULE; |
284 | interface->hl_hdrlen = 0; | 283 | interface->hl_hdrlen = 0; |
@@ -294,7 +293,7 @@ static int __init sc_init(void) | |||
294 | /* | 293 | /* |
295 | * Allocate the board structure | 294 | * Allocate the board structure |
296 | */ | 295 | */ |
297 | sc_adapter[cinst] = kmalloc(sizeof(board), GFP_KERNEL); | 296 | sc_adapter[cinst] = kzalloc(sizeof(board), GFP_KERNEL); |
298 | if (sc_adapter[cinst] == NULL) { | 297 | if (sc_adapter[cinst] == NULL) { |
299 | /* | 298 | /* |
300 | * Oops, can't alloc memory for the board | 299 | * Oops, can't alloc memory for the board |
@@ -302,7 +301,6 @@ static int __init sc_init(void) | |||
302 | kfree(interface); | 301 | kfree(interface); |
303 | continue; | 302 | continue; |
304 | } | 303 | } |
305 | memset(sc_adapter[cinst], 0, sizeof(board)); | ||
306 | spin_lock_init(&sc_adapter[cinst]->lock); | 304 | spin_lock_init(&sc_adapter[cinst]->lock); |
307 | 305 | ||
308 | if(!register_isdn(interface)) { | 306 | if(!register_isdn(interface)) { |
@@ -326,7 +324,7 @@ static int __init sc_init(void) | |||
326 | /* | 324 | /* |
327 | * Allocate channels status structures | 325 | * Allocate channels status structures |
328 | */ | 326 | */ |
329 | sc_adapter[cinst]->channel = kmalloc(sizeof(bchan) * channels, GFP_KERNEL); | 327 | sc_adapter[cinst]->channel = kzalloc(sizeof(bchan) * channels, GFP_KERNEL); |
330 | if (sc_adapter[cinst]->channel == NULL) { | 328 | if (sc_adapter[cinst]->channel == NULL) { |
331 | /* | 329 | /* |
332 | * Oops, can't alloc memory for the channels | 330 | * Oops, can't alloc memory for the channels |
@@ -336,7 +334,6 @@ static int __init sc_init(void) | |||
336 | kfree(sc_adapter[cinst]); | 334 | kfree(sc_adapter[cinst]); |
337 | continue; | 335 | continue; |
338 | } | 336 | } |
339 | memset(sc_adapter[cinst]->channel, 0, sizeof(bchan) * channels); | ||
340 | 337 | ||
341 | /* | 338 | /* |
342 | * Lock down the hardware resources | 339 | * Lock down the hardware resources |