Skip to content

Commit 41f9693

Browse files
Burman YanLinus Torvalds
authored andcommitted
[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>
1 parent 0b2dd13 commit 41f9693

30 files changed

Lines changed: 46 additions & 99 deletions

‎drivers/isdn/act2000/module.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,12 +573,11 @@ act2000_alloccard(int bus, int port, int irq, char *id)
573573
{
574574
int i;
575575
act2000_card *card;
576-
if (!(card = (act2000_card *) kmalloc(sizeof(act2000_card), GFP_KERNEL))) {
576+
if (!(card = kzalloc(sizeof(act2000_card), GFP_KERNEL))) {
577577
printk(KERN_WARNING
578578
"act2000: (%s) Could not allocate card-struct.\n", id);
579579
return;
580580
}
581-
memset((char *) card, 0, sizeof(act2000_card));
582581
spin_lock_init(&card->lock);
583582
spin_lock_init(&card->mnlock);
584583
skb_queue_head_init(&card->sndq);

‎drivers/isdn/capi/capi.c‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,12 @@ static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci)
215215
unsigned int minor = 0;
216216
unsigned long flags;
217217

218-
mp = kmalloc(sizeof(*mp), GFP_ATOMIC);
218+
mp = kzalloc(sizeof(*mp), GFP_ATOMIC);
219219
if (!mp) {
220220
printk(KERN_ERR "capi: can't alloc capiminor\n");
221221
return NULL;
222222
}
223223

224-
memset(mp, 0, sizeof(struct capiminor));
225224
mp->ap = ap;
226225
mp->ncci = ncci;
227226
mp->msgid = 0;
@@ -304,10 +303,9 @@ static struct capincci *capincci_alloc(struct capidev *cdev, u32 ncci)
304303
struct capiminor *mp = NULL;
305304
#endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
306305

307-
np = kmalloc(sizeof(*np), GFP_ATOMIC);
306+
np = kzalloc(sizeof(*np), GFP_ATOMIC);
308307
if (!np)
309308
return NULL;
310-
memset(np, 0, sizeof(struct capincci));
311309
np->ncci = ncci;
312310
np->cdev = cdev;
313311
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
@@ -384,10 +382,9 @@ static struct capidev *capidev_alloc(void)
384382
struct capidev *cdev;
385383
unsigned long flags;
386384

387-
cdev = kmalloc(sizeof(*cdev), GFP_KERNEL);
385+
cdev = kzalloc(sizeof(*cdev), GFP_KERNEL);
388386
if (!cdev)
389387
return NULL;
390-
memset(cdev, 0, sizeof(struct capidev));
391388

392389
init_MUTEX(&cdev->ncci_list_sem);
393390
skb_queue_head_init(&cdev->recvqueue);

‎drivers/isdn/capi/capidrv.c‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,11 @@ static capidrv_plci *new_plci(capidrv_contr * card, int chan)
334334
{
335335
capidrv_plci *plcip;
336336

337-
plcip = (capidrv_plci *) kmalloc(sizeof(capidrv_plci), GFP_ATOMIC);
337+
plcip = kzalloc(sizeof(capidrv_plci), GFP_ATOMIC);
338338

339339
if (plcip == 0)
340340
return NULL;
341341

342-
memset(plcip, 0, sizeof(capidrv_plci));
343342
plcip->state = ST_PLCI_NONE;
344343
plcip->plci = 0;
345344
plcip->msgid = 0;
@@ -404,12 +403,11 @@ static inline capidrv_ncci *new_ncci(capidrv_contr * card,
404403
{
405404
capidrv_ncci *nccip;
406405

407-
nccip = (capidrv_ncci *) kmalloc(sizeof(capidrv_ncci), GFP_ATOMIC);
406+
nccip = kzalloc(sizeof(capidrv_ncci), GFP_ATOMIC);
408407

409408
if (nccip == 0)
410409
return NULL;
411410

412-
memset(nccip, 0, sizeof(capidrv_ncci));
413411
nccip->ncci = ncci;
414412
nccip->state = ST_NCCI_NONE;
415413
nccip->plcip = plcip;
@@ -2005,12 +2003,11 @@ static int capidrv_addcontr(u16 contr, struct capi_profile *profp)
20052003
printk(KERN_WARNING "capidrv: (%s) Could not reserve module\n", id);
20062004
return -1;
20072005
}
2008-
if (!(card = (capidrv_contr *) kmalloc(sizeof(capidrv_contr), GFP_ATOMIC))) {
2006+
if (!(card = kzalloc(sizeof(capidrv_contr), GFP_ATOMIC))) {
20092007
printk(KERN_WARNING
20102008
"capidrv: (%s) Could not allocate contr-struct.\n", id);
20112009
return -1;
20122010
}
2013-
memset(card, 0, sizeof(capidrv_contr));
20142011
card->owner = THIS_MODULE;
20152012
init_timer(&card->listentimer);
20162013
strcpy(card->name, id);

‎drivers/isdn/hardware/avm/avm_cs.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,9 @@ static int avmcs_probe(struct pcmcia_device *p_dev)
121121
p_dev->conf.Present = PRESENT_OPTION;
122122

123123
/* 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);
125125
if (!local)
126126
goto err;
127-
memset(local, 0, sizeof(local_info_t));
128127
p_dev->priv = local;
129128

130129
return avmcs_config(p_dev);

‎drivers/isdn/hardware/avm/b1.c‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,15 @@ avmcard *b1_alloc_card(int nr_controllers)
6565
avmctrl_info *cinfo;
6666
int i;
6767

68-
card = kmalloc(sizeof(*card), GFP_KERNEL);
68+
card = kzalloc(sizeof(*card), GFP_KERNEL);
6969
if (!card)
7070
return NULL;
7171

72-
memset(card, 0, sizeof(*card));
73-
74-
cinfo = kmalloc(sizeof(*cinfo) * nr_controllers, GFP_KERNEL);
72+
cinfo = kzalloc(sizeof(*cinfo) * nr_controllers, GFP_KERNEL);
7573
if (!cinfo) {
7674
kfree(card);
7775
return NULL;
7876
}
79-
memset(cinfo, 0, sizeof(*cinfo) * nr_controllers);
8077

8178
card->ctrlinfo = cinfo;
8279
for (i = 0; i < nr_controllers; i++) {
@@ -718,12 +715,11 @@ avmcard_dma_alloc(char *name, struct pci_dev *pdev, long rsize, long ssize)
718715
avmcard_dmainfo *p;
719716
void *buf;
720717

721-
p = kmalloc(sizeof(avmcard_dmainfo), GFP_KERNEL);
718+
p = kzalloc(sizeof(avmcard_dmainfo), GFP_KERNEL);
722719
if (!p) {
723720
printk(KERN_WARNING "%s: no memory.\n", name);
724721
goto err;
725722
}
726-
memset(p, 0, sizeof(avmcard_dmainfo));
727723

728724
p->recvbuf.size = rsize;
729725
buf = pci_alloc_consistent(pdev, rsize, &p->recvbuf.dmaaddr);

‎drivers/isdn/hisax/avma1_cs.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,10 @@ static int avma1cs_probe(struct pcmcia_device *p_dev)
123123
DEBUG(0, "avma1cs_attach()\n");
124124

125125
/* 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);
127127
if (!local)
128128
return -ENOMEM;
129129

130-
memset(local, 0, sizeof(local_info_t));
131130
p_dev->priv = local;
132131

133132
/* The io structure describes IO port mapping */

‎drivers/isdn/hisax/config.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,14 +869,13 @@ static int checkcard(int cardnr, char *id, int *busy_flag, struct module *lockow
869869
struct IsdnCard *card = cards + cardnr;
870870
struct IsdnCardState *cs;
871871

872-
cs = kmalloc(sizeof(struct IsdnCardState), GFP_ATOMIC);
872+
cs = kzalloc(sizeof(struct IsdnCardState), GFP_ATOMIC);
873873
if (!cs) {
874874
printk(KERN_WARNING
875875
"HiSax: No memory for IsdnCardState(card %d)\n",
876876
cardnr + 1);
877877
goto out;
878878
}
879-
memset(cs, 0, sizeof(struct IsdnCardState));
880879
card->cs = cs;
881880
spin_lock_init(&cs->statlock);
882881
spin_lock_init(&cs->lock);

‎drivers/isdn/hisax/elsa_cs.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,8 @@ static int elsa_cs_probe(struct pcmcia_device *link)
146146
DEBUG(0, "elsa_cs_attach()\n");
147147

148148
/* 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);
150150
if (!local) return -ENOMEM;
151-
memset(local, 0, sizeof(local_info_t));
152151

153152
local->p_dev = link;
154153
link->priv = local;

‎drivers/isdn/hisax/fsm.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ FsmNew(struct Fsm *fsm, struct FsmNode *fnlist, int fncount)
2626
int i;
2727

2828
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);
3030
if (!fsm->jumpmatrix)
3131
return -ENOMEM;
3232

33-
memset(fsm->jumpmatrix, 0, sizeof (FSMFNPTR) * fsm->state_count * fsm->event_count);
34-
3533
for (i = 0; i < fncount; i++)
3634
if ((fnlist[i].state>=fsm->state_count) || (fnlist[i].event>=fsm->event_count)) {
3735
printk(KERN_ERR "FsmNew Error line %d st(%ld/%ld) ev(%ld/%ld)\n",

‎drivers/isdn/hisax/hfc4s8s_l1.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,11 +1591,10 @@ hfc4s8s_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
15911591
hfc4s8s_param *driver_data = (hfc4s8s_param *) ent->driver_data;
15921592
hfc4s8s_hw *hw;
15931593

1594-
if (!(hw = kmalloc(sizeof(hfc4s8s_hw), GFP_ATOMIC))) {
1594+
if (!(hw = kzalloc(sizeof(hfc4s8s_hw), GFP_ATOMIC))) {
15951595
printk(KERN_ERR "No kmem for HFC-4S/8S card\n");
15961596
return (err);
15971597
}
1598-
memset(hw, 0, sizeof(hfc4s8s_hw));
15991598

16001599
hw->pdev = pdev;
16011600
err = pci_enable_device(pdev);

0 commit comments

Comments
 (0)