Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Burman Yan and committed by
Linus Torvalds
41f96935 0b2dd130

+46 -99
+1 -2
drivers/isdn/act2000/module.c
··· 573 573 { 574 574 int i; 575 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 577 printk(KERN_WARNING 578 578 "act2000: (%s) Could not allocate card-struct.\n", id); 579 579 return; 580 580 } 581 - memset((char *) card, 0, sizeof(act2000_card)); 582 581 spin_lock_init(&card->lock); 583 582 spin_lock_init(&card->mnlock); 584 583 skb_queue_head_init(&card->sndq);
+3 -6
drivers/isdn/capi/capi.c
··· 215 215 unsigned int minor = 0; 216 216 unsigned long flags; 217 217 218 - mp = kmalloc(sizeof(*mp), GFP_ATOMIC); 218 + mp = kzalloc(sizeof(*mp), GFP_ATOMIC); 219 219 if (!mp) { 220 220 printk(KERN_ERR "capi: can't alloc capiminor\n"); 221 221 return NULL; 222 222 } 223 223 224 - memset(mp, 0, sizeof(struct capiminor)); 225 224 mp->ap = ap; 226 225 mp->ncci = ncci; 227 226 mp->msgid = 0; ··· 303 304 struct capiminor *mp = NULL; 304 305 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ 305 306 306 - np = kmalloc(sizeof(*np), GFP_ATOMIC); 307 + np = kzalloc(sizeof(*np), GFP_ATOMIC); 307 308 if (!np) 308 309 return NULL; 309 - memset(np, 0, sizeof(struct capincci)); 310 310 np->ncci = ncci; 311 311 np->cdev = cdev; 312 312 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE ··· 382 384 struct capidev *cdev; 383 385 unsigned long flags; 384 386 385 - cdev = kmalloc(sizeof(*cdev), GFP_KERNEL); 387 + cdev = kzalloc(sizeof(*cdev), GFP_KERNEL); 386 388 if (!cdev) 387 389 return NULL; 388 - memset(cdev, 0, sizeof(struct capidev)); 389 390 390 391 init_MUTEX(&cdev->ncci_list_sem); 391 392 skb_queue_head_init(&cdev->recvqueue);
+3 -6
drivers/isdn/capi/capidrv.c
··· 334 334 { 335 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 339 if (plcip == 0) 340 340 return NULL; 341 341 342 - memset(plcip, 0, sizeof(capidrv_plci)); 343 342 plcip->state = ST_PLCI_NONE; 344 343 plcip->plci = 0; 345 344 plcip->msgid = 0; ··· 403 404 { 404 405 capidrv_ncci *nccip; 405 406 406 - nccip = (capidrv_ncci *) kmalloc(sizeof(capidrv_ncci), GFP_ATOMIC); 407 + nccip = kzalloc(sizeof(capidrv_ncci), GFP_ATOMIC); 407 408 408 409 if (nccip == 0) 409 410 return NULL; 410 411 411 - memset(nccip, 0, sizeof(capidrv_ncci)); 412 412 nccip->ncci = ncci; 413 413 nccip->state = ST_NCCI_NONE; 414 414 nccip->plcip = plcip; ··· 2003 2005 printk(KERN_WARNING "capidrv: (%s) Could not reserve module\n", id); 2004 2006 return -1; 2005 2007 } 2006 - if (!(card = (capidrv_contr *) kmalloc(sizeof(capidrv_contr), GFP_ATOMIC))) { 2008 + if (!(card = kzalloc(sizeof(capidrv_contr), GFP_ATOMIC))) { 2007 2009 printk(KERN_WARNING 2008 2010 "capidrv: (%s) Could not allocate contr-struct.\n", id); 2009 2011 return -1; 2010 2012 } 2011 - memset(card, 0, sizeof(capidrv_contr)); 2012 2013 card->owner = THIS_MODULE; 2013 2014 init_timer(&card->listentimer); 2014 2015 strcpy(card->name, id);
+1 -2
drivers/isdn/hardware/avm/avm_cs.c
··· 121 121 p_dev->conf.Present = PRESENT_OPTION; 122 122 123 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 125 if (!local) 126 126 goto err; 127 - memset(local, 0, sizeof(local_info_t)); 128 127 p_dev->priv = local; 129 128 130 129 return avmcs_config(p_dev);
+3 -7
drivers/isdn/hardware/avm/b1.c
··· 65 65 avmctrl_info *cinfo; 66 66 int i; 67 67 68 - card = kmalloc(sizeof(*card), GFP_KERNEL); 68 + card = kzalloc(sizeof(*card), GFP_KERNEL); 69 69 if (!card) 70 70 return NULL; 71 71 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); 75 73 if (!cinfo) { 76 74 kfree(card); 77 75 return NULL; 78 76 } 79 - memset(cinfo, 0, sizeof(*cinfo) * nr_controllers); 80 77 81 78 card->ctrlinfo = cinfo; 82 79 for (i = 0; i < nr_controllers; i++) { ··· 715 718 avmcard_dmainfo *p; 716 719 void *buf; 717 720 718 - p = kmalloc(sizeof(avmcard_dmainfo), GFP_KERNEL); 721 + p = kzalloc(sizeof(avmcard_dmainfo), GFP_KERNEL); 719 722 if (!p) { 720 723 printk(KERN_WARNING "%s: no memory.\n", name); 721 724 goto err; 722 725 } 723 - memset(p, 0, sizeof(avmcard_dmainfo)); 724 726 725 727 p->recvbuf.size = rsize; 726 728 buf = pci_alloc_consistent(pdev, rsize, &p->recvbuf.dmaaddr);
+1 -2
drivers/isdn/hisax/avma1_cs.c
··· 123 123 DEBUG(0, "avma1cs_attach()\n"); 124 124 125 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 127 if (!local) 128 128 return -ENOMEM; 129 129 130 - memset(local, 0, sizeof(local_info_t)); 131 130 p_dev->priv = local; 132 131 133 132 /* The io structure describes IO port mapping */
+1 -2
drivers/isdn/hisax/config.c
··· 869 869 struct IsdnCard *card = cards + cardnr; 870 870 struct IsdnCardState *cs; 871 871 872 - cs = kmalloc(sizeof(struct IsdnCardState), GFP_ATOMIC); 872 + cs = kzalloc(sizeof(struct IsdnCardState), GFP_ATOMIC); 873 873 if (!cs) { 874 874 printk(KERN_WARNING 875 875 "HiSax: No memory for IsdnCardState(card %d)\n", 876 876 cardnr + 1); 877 877 goto out; 878 878 } 879 - memset(cs, 0, sizeof(struct IsdnCardState)); 880 879 card->cs = cs; 881 880 spin_lock_init(&cs->statlock); 882 881 spin_lock_init(&cs->lock);
+1 -2
drivers/isdn/hisax/elsa_cs.c
··· 146 146 DEBUG(0, "elsa_cs_attach()\n"); 147 147 148 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 150 if (!local) return -ENOMEM; 151 - memset(local, 0, sizeof(local_info_t)); 152 151 153 152 local->p_dev = link; 154 153 link->priv = local;
+1 -3
drivers/isdn/hisax/fsm.c
··· 26 26 int i; 27 27 28 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 30 if (!fsm->jumpmatrix) 31 31 return -ENOMEM; 32 - 33 - memset(fsm->jumpmatrix, 0, sizeof (FSMFNPTR) * fsm->state_count * fsm->event_count); 34 32 35 33 for (i = 0; i < fncount; i++) 36 34 if ((fnlist[i].state>=fsm->state_count) || (fnlist[i].event>=fsm->event_count)) {
+1 -2
drivers/isdn/hisax/hfc4s8s_l1.c
··· 1591 1591 hfc4s8s_param *driver_data = (hfc4s8s_param *) ent->driver_data; 1592 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 1595 printk(KERN_ERR "No kmem for HFC-4S/8S card\n"); 1596 1596 return (err); 1597 1597 } 1598 - memset(hw, 0, sizeof(hfc4s8s_hw)); 1599 1598 1600 1599 hw->pdev = pdev; 1601 1600 err = pci_enable_device(pdev);
+1 -2
drivers/isdn/hisax/hfc_usb.c
··· 1481 1481 iface = iface_used; 1482 1482 if (! 1483 1483 (context = 1484 - kmalloc(sizeof(hfcusb_data), GFP_KERNEL))) 1484 + kzalloc(sizeof(hfcusb_data), GFP_KERNEL))) 1485 1485 return (-ENOMEM); /* got no mem */ 1486 - memset(context, 0, sizeof(hfcusb_data)); 1487 1486 1488 1487 ep = iface->endpoint; 1489 1488 vcf = validconf[small_match];
+1 -3
drivers/isdn/hisax/hisax_fcpcipnp.c
··· 841 841 struct hisax_b_if *b_if[2]; 842 842 int i; 843 843 844 - adapter = kmalloc(sizeof(struct fritz_adapter), GFP_KERNEL); 844 + adapter = kzalloc(sizeof(struct fritz_adapter), GFP_KERNEL); 845 845 if (!adapter) 846 846 return NULL; 847 - 848 - memset(adapter, 0, sizeof(struct fritz_adapter)); 849 847 850 848 adapter->isac.hisax_d_if.owner = THIS_MODULE; 851 849 adapter->isac.hisax_d_if.ifc.priv = &adapter->isac;
+1 -2
drivers/isdn/hisax/sedlbauer_cs.c
··· 155 155 DEBUG(0, "sedlbauer_attach()\n"); 156 156 157 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 159 if (!local) return -ENOMEM; 160 - memset(local, 0, sizeof(local_info_t)); 161 160 local->cardnr = -1; 162 161 163 162 local->p_dev = link;
+1 -3
drivers/isdn/hisax/st5481_init.c
··· 69 69 le16_to_cpu(dev->descriptor.idProduct), 70 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 73 if (!adapter) 74 74 return -ENOMEM; 75 - 76 - memset(adapter, 0, sizeof(struct st5481_adapter)); 77 75 78 76 adapter->number_of_leds = number_of_leds; 79 77 adapter->usb_dev = dev;
+1 -2
drivers/isdn/hisax/teles_cs.c
··· 137 137 DEBUG(0, "teles_attach()\n"); 138 138 139 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 141 if (!local) return -ENOMEM; 142 - memset(local, 0, sizeof(local_info_t)); 143 142 local->cardnr = -1; 144 143 145 144 local->p_dev = link;
+1 -2
drivers/isdn/hysdn/hycapi.c
··· 745 745 return 1; 746 746 } 747 747 if (!card->hyctrlinfo) { 748 - cinfo = (hycapictrl_info *) kmalloc(sizeof(hycapictrl_info), GFP_ATOMIC); 748 + cinfo = kzalloc(sizeof(hycapictrl_info), GFP_ATOMIC); 749 749 if (!cinfo) { 750 750 printk(KERN_WARNING "HYSDN: no memory for capi-ctrl.\n"); 751 751 return -ENOMEM; 752 752 } 753 - memset(cinfo, 0, sizeof(hycapictrl_info)); 754 753 card->hyctrlinfo = cinfo; 755 754 cinfo->card = card; 756 755 spin_lock_init(&cinfo->lock);
+1 -2
drivers/isdn/hysdn/hysdn_boot.c
··· 278 278 return (-ERR_ALREADY_BOOT); /* boot already active */ 279 279 } 280 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 282 if (card->debug_flags & LOG_MEM_ERR) 283 283 hysdn_addlog(card, "POF open: unable to allocate mem"); 284 284 return (-EFAULT); 285 285 } 286 286 card->boot = boot; 287 287 card->state = CARD_STATE_BOOTING; 288 - memset(boot, 0, sizeof(struct boot_data)); 289 288 290 289 card->stopcard(card); /* first stop the card */ 291 290 if (card->testram(card)) {
+1 -2
drivers/isdn/hysdn/hysdn_init.c
··· 81 81 if (pci_enable_device(akt_pcidev)) 82 82 continue; 83 83 84 - if (!(card = kmalloc(sizeof(hysdn_card), GFP_KERNEL))) { 84 + if (!(card = kzalloc(sizeof(hysdn_card), GFP_KERNEL))) { 85 85 printk(KERN_ERR "HYSDN: unable to alloc device mem \n"); 86 86 return; 87 87 } 88 - memset(card, 0, sizeof(hysdn_card)); 89 88 card->myid = cardmax; /* set own id */ 90 89 card->bus = akt_pcidev->bus->number; 91 90 card->devfn = akt_pcidev->devfn; /* slot + function */
+1 -2
drivers/isdn/hysdn/hysdn_net.c
··· 278 278 return (-ENOMEM); 279 279 } 280 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 282 printk(KERN_WARNING "HYSDN: unable to allocate mem\n"); 283 283 return (-ENOMEM); 284 284 } 285 - memset(dev, 0, sizeof(struct net_local)); /* clean the structure */ 286 285 287 286 spin_lock_init(&((struct net_local *) dev)->lock); 288 287
+1 -2
drivers/isdn/hysdn/hysdn_proclog.c
··· 405 405 406 406 /* create a cardlog proc entry */ 407 407 408 - if ((pd = (struct procdata *) kmalloc(sizeof(struct procdata), GFP_KERNEL)) != NULL) { 409 - memset(pd, 0, sizeof(struct procdata)); 408 + if ((pd = kzalloc(sizeof(struct procdata), GFP_KERNEL)) != NULL) { 410 409 sprintf(pd->log_name, "%s%d", PROC_LOG_BASENAME, card->myid); 411 410 if ((pd->log = create_proc_entry(pd->log_name, S_IFREG | S_IRUGO | S_IWUSR, hysdn_proc_entry)) != NULL) { 412 411 pd->log->proc_fops = &log_fops;
+1 -3
drivers/isdn/i4l/isdn_bsdcomp.c
··· 331 331 * Allocate the main control structure for this instance. 332 332 */ 333 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 335 if (!db) 336 336 return NULL; 337 - 338 - memset (db, 0, sizeof(struct bsd_db)); 339 337 340 338 db->xmit = data->flags & IPPP_COMP_FLAG_XMIT; 341 339 decomp = db->xmit ? 0 : 1;
+3 -6
drivers/isdn/i4l/isdn_common.c
··· 2072 2072 2073 2073 if ((adding) && (d->rcverr)) 2074 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 2076 printk(KERN_WARNING "register_isdn: Could not alloc rcverr\n"); 2077 2077 return -1; 2078 2078 } 2079 - memset((char *) d->rcverr, 0, sizeof(int) * m); 2080 2079 2081 2080 if ((adding) && (d->rcvcount)) 2082 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 2083 printk(KERN_WARNING "register_isdn: Could not alloc rcvcount\n"); 2085 2084 if (!adding) 2086 2085 kfree(d->rcverr); 2087 2086 return -1; 2088 2087 } 2089 - memset((char *) d->rcvcount, 0, sizeof(int) * m); 2090 2088 2091 2089 if ((adding) && (d->rpqueue)) { 2092 2090 for (j = 0; j < d->channels; j++) ··· 2224 2226 printk(KERN_WARNING "register_isdn: No write routine given.\n"); 2225 2227 return 0; 2226 2228 } 2227 - if (!(d = kmalloc(sizeof(isdn_driver_t), GFP_KERNEL))) { 2229 + if (!(d = kzalloc(sizeof(isdn_driver_t), GFP_KERNEL))) { 2228 2230 printk(KERN_WARNING "register_isdn: Could not alloc driver-struct\n"); 2229 2231 return 0; 2230 2232 } 2231 - memset((char *) d, 0, sizeof(isdn_driver_t)); 2232 2233 2233 2234 d->maxbufsize = i->maxbufsize; 2234 2235 d->pktcount = 0;
+2 -4
drivers/isdn/i4l/isdn_net.c
··· 2542 2542 printk(KERN_WARNING "isdn_net: interface %s already exists\n", name); 2543 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 2546 printk(KERN_WARNING "isdn_net: Could not allocate net-device\n"); 2547 2547 return NULL; 2548 2548 } 2549 - memset(netdev, 0, sizeof(isdn_net_dev)); 2550 - if (!(netdev->local = (isdn_net_local *) kmalloc(sizeof(isdn_net_local), GFP_KERNEL))) { 2549 + if (!(netdev->local = kzalloc(sizeof(isdn_net_local), GFP_KERNEL))) { 2551 2550 printk(KERN_WARNING "isdn_net: Could not allocate device locals\n"); 2552 2551 kfree(netdev); 2553 2552 return NULL; 2554 2553 } 2555 - memset(netdev->local, 0, sizeof(isdn_net_local)); 2556 2554 if (name == NULL) 2557 2555 strcpy(netdev->local->name, " "); 2558 2556 else
+4 -10
drivers/isdn/i4l/isdn_ppp.c
··· 876 876 #endif /* CONFIG_ISDN_MPP */ 877 877 878 878 for (i = 0; i < ISDN_MAX_CHANNELS; i++) { 879 - if (!(ippp_table[i] = (struct ippp_struct *) 880 - kmalloc(sizeof(struct ippp_struct), GFP_KERNEL))) { 879 + if (!(ippp_table[i] = kzalloc(sizeof(struct ippp_struct), GFP_KERNEL))) { 881 880 printk(KERN_WARNING "isdn_ppp_init: Could not alloc ippp_table\n"); 882 881 for (j = 0; j < i; j++) 883 882 kfree(ippp_table[j]); 884 883 return -1; 885 884 } 886 - memset((char *) ippp_table[i], 0, sizeof(struct ippp_struct)); 887 885 spin_lock_init(&ippp_table[i]->buflock); 888 886 ippp_table[i]->state = 0; 889 887 ippp_table[i]->first = ippp_table[i]->rq + NUM_RCV_BUFFS - 1; ··· 1527 1529 { 1528 1530 int i; 1529 1531 int sz = ISDN_MAX_CHANNELS*sizeof(ippp_bundle); 1530 - if( (isdn_ppp_bundle_arr = (ippp_bundle*)kmalloc(sz, 1531 - GFP_KERNEL)) == NULL ) 1532 + if( (isdn_ppp_bundle_arr = kzalloc(sz, GFP_KERNEL)) == NULL ) 1532 1533 return -ENOMEM; 1533 - memset(isdn_ppp_bundle_arr, 0, sz); 1534 1534 for( i = 0; i < ISDN_MAX_CHANNELS; i++ ) 1535 1535 spin_lock_init(&isdn_ppp_bundle_arr[i].lock); 1536 1536 return 0; ··· 2242 2246 static struct ippp_ccp_reset *isdn_ppp_ccp_reset_alloc(struct ippp_struct *is) 2243 2247 { 2244 2248 struct ippp_ccp_reset *r; 2245 - r = kmalloc(sizeof(struct ippp_ccp_reset), GFP_KERNEL); 2249 + r = kzalloc(sizeof(struct ippp_ccp_reset), GFP_KERNEL); 2246 2250 if(!r) { 2247 2251 printk(KERN_ERR "ippp_ccp: failed to allocate reset data" 2248 2252 " structure - no mem\n"); 2249 2253 return NULL; 2250 2254 } 2251 - memset(r, 0, sizeof(struct ippp_ccp_reset)); 2252 2255 printk(KERN_DEBUG "ippp_ccp: allocated reset data structure %p\n", r); 2253 2256 is->reset = r; 2254 2257 return r; ··· 2333 2338 id); 2334 2339 return NULL; 2335 2340 } else { 2336 - rs = kmalloc(sizeof(struct ippp_ccp_reset_state), GFP_KERNEL); 2341 + rs = kzalloc(sizeof(struct ippp_ccp_reset_state), GFP_KERNEL); 2337 2342 if(!rs) 2338 2343 return NULL; 2339 - memset(rs, 0, sizeof(struct ippp_ccp_reset_state)); 2340 2344 rs->state = CCPResetIdle; 2341 2345 rs->is = is; 2342 2346 rs->id = id;
+1 -2
drivers/isdn/i4l/isdn_v110.c
··· 92 92 int i; 93 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 96 return NULL; 97 - memset(v, 0, sizeof(isdn_v110_stream)); 98 97 v->key = key; 99 98 v->nbits = 0; 100 99 for (i = 0; key & (1 << i); i++)
+1 -2
drivers/isdn/icn/icn.c
··· 1519 1519 icn_card *card; 1520 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 1523 printk(KERN_WARNING 1524 1524 "icn: (%s) Could not allocate card-struct.\n", id); 1525 1525 return (icn_card *) 0; 1526 1526 } 1527 - memset((char *) card, 0, sizeof(icn_card)); 1528 1527 spin_lock_init(&card->lock); 1529 1528 card->port = port; 1530 1529 card->interface.owner = THIS_MODULE;
+1 -2
drivers/isdn/isdnloop/isdnloop.c
··· 1430 1430 isdnloop_card *card; 1431 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 1434 printk(KERN_WARNING 1435 1435 "isdnloop: (%s) Could not allocate card-struct.\n", id); 1436 1436 return (isdnloop_card *) 0; 1437 1437 } 1438 - memset((char *) card, 0, sizeof(isdnloop_card)); 1439 1438 card->interface.owner = THIS_MODULE; 1440 1439 card->interface.channels = ISDNLOOP_BCH; 1441 1440 card->interface.hl_hdrlen = 1; /* scratch area for storing ack flag*/
+3 -6
drivers/isdn/pcbit/drv.c
··· 73 73 struct pcbit_dev *dev; 74 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 78 printk("pcbit_init: couldn't malloc pcbit_dev struct\n"); 79 79 return -ENOMEM; 80 80 } 81 81 82 82 dev_pcbit[board] = dev; 83 - memset(dev, 0, sizeof(struct pcbit_dev)); 84 83 init_waitqueue_head(&dev->set_running_wq); 85 84 spin_lock_init(&dev->lock); 86 85 ··· 103 104 return -EACCES; 104 105 } 105 106 106 - dev->b1 = kmalloc(sizeof(struct pcbit_chan), GFP_KERNEL); 107 + dev->b1 = kzalloc(sizeof(struct pcbit_chan), GFP_KERNEL); 107 108 if (!dev->b1) { 108 109 printk("pcbit_init: couldn't malloc pcbit_chan struct\n"); 109 110 iounmap(dev->sh_mem); ··· 112 113 return -ENOMEM; 113 114 } 114 115 115 - dev->b2 = kmalloc(sizeof(struct pcbit_chan), GFP_KERNEL); 116 + dev->b2 = kzalloc(sizeof(struct pcbit_chan), GFP_KERNEL); 116 117 if (!dev->b2) { 117 118 printk("pcbit_init: couldn't malloc pcbit_chan struct\n"); 118 119 kfree(dev->b1); ··· 122 123 return -ENOMEM; 123 124 } 124 125 125 - memset(dev->b1, 0, sizeof(struct pcbit_chan)); 126 - memset(dev->b2, 0, sizeof(struct pcbit_chan)); 127 126 dev->b2->id = 1; 128 127 129 128 INIT_WORK(&dev->qdelivery, pcbit_deliver);
+1 -2
drivers/isdn/pcbit/layer2.c
··· 369 369 kfree(dev->read_frame); 370 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 374 if (frame == NULL) { 375 375 printk(KERN_WARNING "kmalloc failed\n"); 376 376 return; 377 377 } 378 - memset(frame, 0, sizeof(struct frame_buf)); 379 378 380 379 cpu = pcbit_readb(dev); 381 380 proc = pcbit_readb(dev);
+3 -6
drivers/isdn/sc/init.c
··· 271 271 * Horray! We found a board, Make sure we can register 272 272 * it with ISDN4Linux 273 273 */ 274 - interface = kmalloc(sizeof(isdn_if), GFP_KERNEL); 274 + interface = kzalloc(sizeof(isdn_if), GFP_KERNEL); 275 275 if (interface == NULL) { 276 276 /* 277 277 * Oops, can't malloc isdn_if 278 278 */ 279 279 continue; 280 280 } 281 - memset(interface, 0, sizeof(isdn_if)); 282 281 283 282 interface->owner = THIS_MODULE; 284 283 interface->hl_hdrlen = 0; ··· 293 294 /* 294 295 * Allocate the board structure 295 296 */ 296 - sc_adapter[cinst] = kmalloc(sizeof(board), GFP_KERNEL); 297 + sc_adapter[cinst] = kzalloc(sizeof(board), GFP_KERNEL); 297 298 if (sc_adapter[cinst] == NULL) { 298 299 /* 299 300 * Oops, can't alloc memory for the board ··· 301 302 kfree(interface); 302 303 continue; 303 304 } 304 - memset(sc_adapter[cinst], 0, sizeof(board)); 305 305 spin_lock_init(&sc_adapter[cinst]->lock); 306 306 307 307 if(!register_isdn(interface)) { ··· 324 326 /* 325 327 * Allocate channels status structures 326 328 */ 327 - sc_adapter[cinst]->channel = kmalloc(sizeof(bchan) * channels, GFP_KERNEL); 329 + sc_adapter[cinst]->channel = kzalloc(sizeof(bchan) * channels, GFP_KERNEL); 328 330 if (sc_adapter[cinst]->channel == NULL) { 329 331 /* 330 332 * Oops, can't alloc memory for the channels ··· 334 336 kfree(sc_adapter[cinst]); 335 337 continue; 336 338 } 337 - memset(sc_adapter[cinst]->channel, 0, sizeof(bchan) * channels); 338 339 339 340 /* 340 341 * Lock down the hardware resources