aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorOm Narasimhan <om.turyx@gmail.com>2006-10-03 19:27:18 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-10-04 03:31:04 -0400
commit0c1cca1d8e0d58775dad43374f925e6cddf1bebc (patch)
tree72b5aee63958025c7e3aa03f76ae40a004b58750 /drivers
parent617dbeaa3f2987acc83c1149409685005e9dd740 (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')
-rw-r--r--drivers/atm/adummy.c6
-rw-r--r--drivers/atm/firestream.c12
-rw-r--r--drivers/atm/he.c4
-rw-r--r--drivers/atm/horizon.c4
-rw-r--r--drivers/atm/idt77252.c23
-rw-r--r--drivers/atm/lanai.c8
-rw-r--r--drivers/atm/zatm.c6
7 files changed, 16 insertions, 47 deletions
diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c
index 6cc93de0b71d..ac2c10822be0 100644
--- a/drivers/atm/adummy.c
+++ b/drivers/atm/adummy.c
@@ -113,15 +113,13 @@ static int __init adummy_init(void)
113 113
114 printk(KERN_ERR "adummy: version %s\n", DRV_VERSION); 114 printk(KERN_ERR "adummy: version %s\n", DRV_VERSION);
115 115
116 adummy_dev = (struct adummy_dev *) kmalloc(sizeof(struct adummy_dev), 116 adummy_dev = kzalloc(sizeof(struct adummy_dev),
117 GFP_KERNEL); 117 GFP_KERNEL);
118 if (!adummy_dev) { 118 if (!adummy_dev) {
119 printk(KERN_ERR DEV_LABEL ": kmalloc() failed\n"); 119 printk(KERN_ERR DEV_LABEL ": kzalloc() failed\n");
120 err = -ENOMEM; 120 err = -ENOMEM;
121 goto out; 121 goto out;
122 } 122 }
123 memset(adummy_dev, 0, sizeof(struct adummy_dev));
124
125 atm_dev = atm_dev_register(DEV_LABEL, &adummy_ops, -1, NULL); 123 atm_dev = atm_dev_register(DEV_LABEL, &adummy_ops, -1, NULL);
126 if (!atm_dev) { 124 if (!atm_dev) {
127 printk(KERN_ERR DEV_LABEL ": atm_dev_register() failed\n"); 125 printk(KERN_ERR DEV_LABEL ": atm_dev_register() failed\n");
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index 38fc054bd671..5f25e5efefcd 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -1784,7 +1784,7 @@ static int __devinit fs_init (struct fs_dev *dev)
1784 write_fs (dev, RAM, (1 << (28 - FS155_VPI_BITS - FS155_VCI_BITS)) - 1); 1784 write_fs (dev, RAM, (1 << (28 - FS155_VPI_BITS - FS155_VCI_BITS)) - 1);
1785 dev->nchannels = FS155_NR_CHANNELS; 1785 dev->nchannels = FS155_NR_CHANNELS;
1786 } 1786 }
1787 dev->atm_vccs = kmalloc (dev->nchannels * sizeof (struct atm_vcc *), 1787 dev->atm_vccs = kcalloc (dev->nchannels, sizeof (struct atm_vcc *),
1788 GFP_KERNEL); 1788 GFP_KERNEL);
1789 fs_dprintk (FS_DEBUG_ALLOC, "Alloc atmvccs: %p(%Zd)\n", 1789 fs_dprintk (FS_DEBUG_ALLOC, "Alloc atmvccs: %p(%Zd)\n",
1790 dev->atm_vccs, dev->nchannels * sizeof (struct atm_vcc *)); 1790 dev->atm_vccs, dev->nchannels * sizeof (struct atm_vcc *));
@@ -1794,9 +1794,8 @@ static int __devinit fs_init (struct fs_dev *dev)
1794 /* XXX Clean up..... */ 1794 /* XXX Clean up..... */
1795 return 1; 1795 return 1;
1796 } 1796 }
1797 memset (dev->atm_vccs, 0, dev->nchannels * sizeof (struct atm_vcc *));
1798 1797
1799 dev->tx_inuse = kmalloc (dev->nchannels / 8 /* bits/byte */ , GFP_KERNEL); 1798 dev->tx_inuse = kzalloc (dev->nchannels / 8 /* bits/byte */ , GFP_KERNEL);
1800 fs_dprintk (FS_DEBUG_ALLOC, "Alloc tx_inuse: %p(%d)\n", 1799 fs_dprintk (FS_DEBUG_ALLOC, "Alloc tx_inuse: %p(%d)\n",
1801 dev->atm_vccs, dev->nchannels / 8); 1800 dev->atm_vccs, dev->nchannels / 8);
1802 1801
@@ -1805,8 +1804,6 @@ static int __devinit fs_init (struct fs_dev *dev)
1805 /* XXX Clean up..... */ 1804 /* XXX Clean up..... */
1806 return 1; 1805 return 1;
1807 } 1806 }
1808 memset (dev->tx_inuse, 0, dev->nchannels / 8);
1809
1810 /* -- RAS1 : FS155 and 50 differ. Default (0) should be OK for both */ 1807 /* -- RAS1 : FS155 and 50 differ. Default (0) should be OK for both */
1811 /* -- RAS2 : FS50 only: Default is OK. */ 1808 /* -- RAS2 : FS50 only: Default is OK. */
1812 1809
@@ -1893,14 +1890,11 @@ static int __devinit firestream_init_one (struct pci_dev *pci_dev,
1893 if (pci_enable_device(pci_dev)) 1890 if (pci_enable_device(pci_dev))
1894 goto err_out; 1891 goto err_out;
1895 1892
1896 fs_dev = kmalloc (sizeof (struct fs_dev), GFP_KERNEL); 1893 fs_dev = kzalloc (sizeof (struct fs_dev), GFP_KERNEL);
1897 fs_dprintk (FS_DEBUG_ALLOC, "Alloc fs-dev: %p(%Zd)\n", 1894 fs_dprintk (FS_DEBUG_ALLOC, "Alloc fs-dev: %p(%Zd)\n",
1898 fs_dev, sizeof (struct fs_dev)); 1895 fs_dev, sizeof (struct fs_dev));
1899 if (!fs_dev) 1896 if (!fs_dev)
1900 goto err_out; 1897 goto err_out;
1901
1902 memset (fs_dev, 0, sizeof (struct fs_dev));
1903
1904 atm_dev = atm_dev_register("fs", &ops, -1, NULL); 1898 atm_dev = atm_dev_register("fs", &ops, -1, NULL);
1905 if (!atm_dev) 1899 if (!atm_dev)
1906 goto err_out_free_fs_dev; 1900 goto err_out_free_fs_dev;
diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index f2511b42dba2..b22a9142b240 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -383,14 +383,12 @@ he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent)
383 } 383 }
384 pci_set_drvdata(pci_dev, atm_dev); 384 pci_set_drvdata(pci_dev, atm_dev);
385 385
386 he_dev = (struct he_dev *) kmalloc(sizeof(struct he_dev), 386 he_dev = kzalloc(sizeof(struct he_dev),
387 GFP_KERNEL); 387 GFP_KERNEL);
388 if (!he_dev) { 388 if (!he_dev) {
389 err = -ENOMEM; 389 err = -ENOMEM;
390 goto init_one_failure; 390 goto init_one_failure;
391 } 391 }
392 memset(he_dev, 0, sizeof(struct he_dev));
393
394 he_dev->pci_dev = pci_dev; 392 he_dev->pci_dev = pci_dev;
395 he_dev->atm_dev = atm_dev; 393 he_dev->atm_dev = atm_dev;
396 he_dev->atm_dev->dev_data = he_dev; 394 he_dev->atm_dev->dev_data = he_dev;
diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c
index d1113e845f95..209dba1c70da 100644
--- a/drivers/atm/horizon.c
+++ b/drivers/atm/horizon.c
@@ -2719,7 +2719,7 @@ static int __devinit hrz_probe(struct pci_dev *pci_dev, const struct pci_device_
2719 goto out_disable; 2719 goto out_disable;
2720 } 2720 }
2721 2721
2722 dev = kmalloc(sizeof(hrz_dev), GFP_KERNEL); 2722 dev = kzalloc(sizeof(hrz_dev), GFP_KERNEL);
2723 if (!dev) { 2723 if (!dev) {
2724 // perhaps we should be nice: deregister all adapters and abort? 2724 // perhaps we should be nice: deregister all adapters and abort?
2725 PRINTD(DBG_ERR, "out of memory"); 2725 PRINTD(DBG_ERR, "out of memory");
@@ -2727,8 +2727,6 @@ static int __devinit hrz_probe(struct pci_dev *pci_dev, const struct pci_device_
2727 goto out_release; 2727 goto out_release;
2728 } 2728 }
2729 2729
2730 memset(dev, 0, sizeof(hrz_dev));
2731
2732 pci_set_drvdata(pci_dev, dev); 2730 pci_set_drvdata(pci_dev, dev);
2733 2731
2734 // grab IRQ and install handler - move this someplace more sensible 2732 // grab IRQ and install handler - move this someplace more sensible
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;
diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index fe60a59b7fc0..b9568e10965a 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -1482,16 +1482,10 @@ static inline void vcc_table_deallocate(const struct lanai_dev *lanai)
1482static inline struct lanai_vcc *new_lanai_vcc(void) 1482static inline struct lanai_vcc *new_lanai_vcc(void)
1483{ 1483{
1484 struct lanai_vcc *lvcc; 1484 struct lanai_vcc *lvcc;
1485 lvcc = (struct lanai_vcc *) kmalloc(sizeof(*lvcc), GFP_KERNEL); 1485 lvcc = kzalloc(sizeof(*lvcc), GFP_KERNEL);
1486 if (likely(lvcc != NULL)) { 1486 if (likely(lvcc != NULL)) {
1487 lvcc->vbase = NULL;
1488 lvcc->rx.atmvcc = lvcc->tx.atmvcc = NULL;
1489 lvcc->nref = 0;
1490 memset(&lvcc->stats, 0, sizeof lvcc->stats);
1491 lvcc->rx.buf.start = lvcc->tx.buf.start = NULL;
1492 skb_queue_head_init(&lvcc->tx.backlog); 1487 skb_queue_head_init(&lvcc->tx.backlog);
1493#ifdef DEBUG 1488#ifdef DEBUG
1494 lvcc->tx.unqueue = NULL;
1495 lvcc->vci = -1; 1489 lvcc->vci = -1;
1496#endif 1490#endif
1497 } 1491 }
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
index 2c65e82f0d6b..c491ec455cac 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
@@ -603,9 +603,8 @@ static int start_rx(struct atm_dev *dev)
603DPRINTK("start_rx\n"); 603DPRINTK("start_rx\n");
604 zatm_dev = ZATM_DEV(dev); 604 zatm_dev = ZATM_DEV(dev);
605 size = sizeof(struct atm_vcc *)*zatm_dev->chans; 605 size = sizeof(struct atm_vcc *)*zatm_dev->chans;
606 zatm_dev->rx_map = (struct atm_vcc **) kmalloc(size,GFP_KERNEL); 606 zatm_dev->rx_map = kzalloc(size,GFP_KERNEL);
607 if (!zatm_dev->rx_map) return -ENOMEM; 607 if (!zatm_dev->rx_map) return -ENOMEM;
608 memset(zatm_dev->rx_map,0,size);
609 /* set VPI/VCI split (use all VCIs and give what's left to VPIs) */ 608 /* set VPI/VCI split (use all VCIs and give what's left to VPIs) */
610 zpokel(zatm_dev,(1 << dev->ci_range.vci_bits)-1,uPD98401_VRR); 609 zpokel(zatm_dev,(1 << dev->ci_range.vci_bits)-1,uPD98401_VRR);
611 /* prepare free buffer pools */ 610 /* prepare free buffer pools */
@@ -951,9 +950,8 @@ static int open_tx_first(struct atm_vcc *vcc)
951 skb_queue_head_init(&zatm_vcc->tx_queue); 950 skb_queue_head_init(&zatm_vcc->tx_queue);
952 init_waitqueue_head(&zatm_vcc->tx_wait); 951 init_waitqueue_head(&zatm_vcc->tx_wait);
953 /* initialize ring */ 952 /* initialize ring */
954 zatm_vcc->ring = kmalloc(RING_SIZE,GFP_KERNEL); 953 zatm_vcc->ring = kzalloc(RING_SIZE,GFP_KERNEL);
955 if (!zatm_vcc->ring) return -ENOMEM; 954 if (!zatm_vcc->ring) return -ENOMEM;
956 memset(zatm_vcc->ring,0,RING_SIZE);
957 loop = zatm_vcc->ring+RING_ENTRIES*RING_WORDS; 955 loop = zatm_vcc->ring+RING_ENTRIES*RING_WORDS;
958 loop[0] = uPD98401_TXPD_V; 956 loop[0] = uPD98401_TXPD_V;
959 loop[1] = loop[2] = 0; 957 loop[1] = loop[2] = 0;