diff options
author | Om Narasimhan <om.turyx@gmail.com> | 2006-10-03 19:27:18 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-10-04 03:31:04 -0400 |
commit | 0c1cca1d8e0d58775dad43374f925e6cddf1bebc (patch) | |
tree | 72b5aee63958025c7e3aa03f76ae40a004b58750 /drivers/atm/idt77252.c | |
parent | 617dbeaa3f2987acc83c1149409685005e9dd740 (diff) |
[ATM]: kmalloc to kzalloc patches for drivers/atm
Signed-off-by: Om Narasimhan <om.turyx@gmail.com>
Signed-off-by: Chas Williams <chas@cmf.nrl.navy.mil>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/atm/idt77252.c')
-rw-r--r-- | drivers/atm/idt77252.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c index b0369bb20f08..7487f0ad68e9 100644 --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c | |||
@@ -642,11 +642,9 @@ alloc_scq(struct idt77252_dev *card, int class) | |||
642 | { | 642 | { |
643 | struct scq_info *scq; | 643 | struct scq_info *scq; |
644 | 644 | ||
645 | scq = (struct scq_info *) kmalloc(sizeof(struct scq_info), GFP_KERNEL); | 645 | scq = kzalloc(sizeof(struct scq_info), GFP_KERNEL); |
646 | if (!scq) | 646 | if (!scq) |
647 | return NULL; | 647 | return NULL; |
648 | memset(scq, 0, sizeof(struct scq_info)); | ||
649 | |||
650 | scq->base = pci_alloc_consistent(card->pcidev, SCQ_SIZE, | 648 | scq->base = pci_alloc_consistent(card->pcidev, SCQ_SIZE, |
651 | &scq->paddr); | 649 | &scq->paddr); |
652 | if (scq->base == NULL) { | 650 | if (scq->base == NULL) { |
@@ -2142,11 +2140,9 @@ idt77252_init_est(struct vc_map *vc, int pcr) | |||
2142 | { | 2140 | { |
2143 | struct rate_estimator *est; | 2141 | struct rate_estimator *est; |
2144 | 2142 | ||
2145 | est = kmalloc(sizeof(struct rate_estimator), GFP_KERNEL); | 2143 | est = kzalloc(sizeof(struct rate_estimator), GFP_KERNEL); |
2146 | if (!est) | 2144 | if (!est) |
2147 | return NULL; | 2145 | return NULL; |
2148 | memset(est, 0, sizeof(*est)); | ||
2149 | |||
2150 | est->maxcps = pcr < 0 ? -pcr : pcr; | 2146 | est->maxcps = pcr < 0 ? -pcr : pcr; |
2151 | est->cps = est->maxcps; | 2147 | est->cps = est->maxcps; |
2152 | est->avcps = est->cps << 5; | 2148 | est->avcps = est->cps << 5; |
@@ -2451,14 +2447,12 @@ idt77252_open(struct atm_vcc *vcc) | |||
2451 | 2447 | ||
2452 | index = VPCI2VC(card, vpi, vci); | 2448 | index = VPCI2VC(card, vpi, vci); |
2453 | if (!card->vcs[index]) { | 2449 | if (!card->vcs[index]) { |
2454 | card->vcs[index] = kmalloc(sizeof(struct vc_map), GFP_KERNEL); | 2450 | card->vcs[index] = kzalloc(sizeof(struct vc_map), GFP_KERNEL); |
2455 | if (!card->vcs[index]) { | 2451 | if (!card->vcs[index]) { |
2456 | printk("%s: can't alloc vc in open()\n", card->name); | 2452 | printk("%s: can't alloc vc in open()\n", card->name); |
2457 | up(&card->mutex); | 2453 | up(&card->mutex); |
2458 | return -ENOMEM; | 2454 | return -ENOMEM; |
2459 | } | 2455 | } |
2460 | memset(card->vcs[index], 0, sizeof(struct vc_map)); | ||
2461 | |||
2462 | card->vcs[index]->card = card; | 2456 | card->vcs[index]->card = card; |
2463 | card->vcs[index]->index = index; | 2457 | card->vcs[index]->index = index; |
2464 | 2458 | ||
@@ -2926,13 +2920,11 @@ open_card_oam(struct idt77252_dev *card) | |||
2926 | for (vci = 3; vci < 5; vci++) { | 2920 | for (vci = 3; vci < 5; vci++) { |
2927 | index = VPCI2VC(card, vpi, vci); | 2921 | index = VPCI2VC(card, vpi, vci); |
2928 | 2922 | ||
2929 | vc = kmalloc(sizeof(struct vc_map), GFP_KERNEL); | 2923 | vc = kzalloc(sizeof(struct vc_map), GFP_KERNEL); |
2930 | if (!vc) { | 2924 | if (!vc) { |
2931 | printk("%s: can't alloc vc\n", card->name); | 2925 | printk("%s: can't alloc vc\n", card->name); |
2932 | return -ENOMEM; | 2926 | return -ENOMEM; |
2933 | } | 2927 | } |
2934 | memset(vc, 0, sizeof(struct vc_map)); | ||
2935 | |||
2936 | vc->index = index; | 2928 | vc->index = index; |
2937 | card->vcs[index] = vc; | 2929 | card->vcs[index] = vc; |
2938 | 2930 | ||
@@ -2995,12 +2987,11 @@ open_card_ubr0(struct idt77252_dev *card) | |||
2995 | { | 2987 | { |
2996 | struct vc_map *vc; | 2988 | struct vc_map *vc; |
2997 | 2989 | ||
2998 | vc = kmalloc(sizeof(struct vc_map), GFP_KERNEL); | 2990 | vc = kzalloc(sizeof(struct vc_map), GFP_KERNEL); |
2999 | if (!vc) { | 2991 | if (!vc) { |
3000 | printk("%s: can't alloc vc\n", card->name); | 2992 | printk("%s: can't alloc vc\n", card->name); |
3001 | return -ENOMEM; | 2993 | return -ENOMEM; |
3002 | } | 2994 | } |
3003 | memset(vc, 0, sizeof(struct vc_map)); | ||
3004 | card->vcs[0] = vc; | 2995 | card->vcs[0] = vc; |
3005 | vc->class = SCHED_UBR0; | 2996 | vc->class = SCHED_UBR0; |
3006 | 2997 | ||
@@ -3695,14 +3686,12 @@ idt77252_init_one(struct pci_dev *pcidev, const struct pci_device_id *id) | |||
3695 | goto err_out_disable_pdev; | 3686 | goto err_out_disable_pdev; |
3696 | } | 3687 | } |
3697 | 3688 | ||
3698 | card = kmalloc(sizeof(struct idt77252_dev), GFP_KERNEL); | 3689 | card = kzalloc(sizeof(struct idt77252_dev), GFP_KERNEL); |
3699 | if (!card) { | 3690 | if (!card) { |
3700 | printk("idt77252-%d: can't allocate private data\n", index); | 3691 | printk("idt77252-%d: can't allocate private data\n", index); |
3701 | err = -ENOMEM; | 3692 | err = -ENOMEM; |
3702 | goto err_out_disable_pdev; | 3693 | goto err_out_disable_pdev; |
3703 | } | 3694 | } |
3704 | memset(card, 0, sizeof(struct idt77252_dev)); | ||
3705 | |||
3706 | card->revision = revision; | 3695 | card->revision = revision; |
3707 | card->index = index; | 3696 | card->index = index; |
3708 | card->pcidev = pcidev; | 3697 | card->pcidev = pcidev; |