aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-11-21 19:15:06 -0500
committerDavid S. Miller <davem@davemloft.net>2010-11-28 01:53:38 -0500
commit89bf67f1f080c947c92f8773482d9e57767ca292 (patch)
treeae492f5f31a32a4f838778cd34320da0bedf9dfd /drivers
parentfe6d2a38b2076cba515dc95b5dc1589a7ab51c17 (diff)
drivers/net: use vzalloc()
Use vzalloc() and vzalloc_node() in net drivers Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Acked-by: Jon Mason <jon.mason@exar.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/bnx2.c9
-rw-r--r--drivers/net/cxgb3/cxgb3_offload.c6
-rw-r--r--drivers/net/cxgb4/cxgb4_main.c6
-rw-r--r--drivers/net/e1000/e1000_main.c6
-rw-r--r--drivers/net/e1000e/netdev.c6
-rw-r--r--drivers/net/ehea/ehea_main.c4
-rw-r--r--drivers/net/igb/igb_main.c6
-rw-r--r--drivers/net/igbvf/netdev.c6
-rw-r--r--drivers/net/ixgb/ixgb_main.c6
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c10
-rw-r--r--drivers/net/ixgbevf/ixgbevf_main.c6
-rw-r--r--drivers/net/netxen/netxen_nic_init.c6
-rw-r--r--drivers/net/pch_gbe/pch_gbe_main.c6
-rw-r--r--drivers/net/pptp.c3
-rw-r--r--drivers/net/qlcnic/qlcnic_init.c6
-rw-r--r--drivers/net/sfc/filter.c3
-rw-r--r--drivers/net/vxge/vxge-config.c31
17 files changed, 39 insertions, 87 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 062600be073b..0de196da4d4a 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -766,13 +766,10 @@ bnx2_alloc_rx_mem(struct bnx2 *bp)
766 int j; 766 int j;
767 767
768 rxr->rx_buf_ring = 768 rxr->rx_buf_ring =
769 vmalloc(SW_RXBD_RING_SIZE * bp->rx_max_ring); 769 vzalloc(SW_RXBD_RING_SIZE * bp->rx_max_ring);
770 if (rxr->rx_buf_ring == NULL) 770 if (rxr->rx_buf_ring == NULL)
771 return -ENOMEM; 771 return -ENOMEM;
772 772
773 memset(rxr->rx_buf_ring, 0,
774 SW_RXBD_RING_SIZE * bp->rx_max_ring);
775
776 for (j = 0; j < bp->rx_max_ring; j++) { 773 for (j = 0; j < bp->rx_max_ring; j++) {
777 rxr->rx_desc_ring[j] = 774 rxr->rx_desc_ring[j] =
778 dma_alloc_coherent(&bp->pdev->dev, 775 dma_alloc_coherent(&bp->pdev->dev,
@@ -785,13 +782,11 @@ bnx2_alloc_rx_mem(struct bnx2 *bp)
785 } 782 }
786 783
787 if (bp->rx_pg_ring_size) { 784 if (bp->rx_pg_ring_size) {
788 rxr->rx_pg_ring = vmalloc(SW_RXPG_RING_SIZE * 785 rxr->rx_pg_ring = vzalloc(SW_RXPG_RING_SIZE *
789 bp->rx_max_pg_ring); 786 bp->rx_max_pg_ring);
790 if (rxr->rx_pg_ring == NULL) 787 if (rxr->rx_pg_ring == NULL)
791 return -ENOMEM; 788 return -ENOMEM;
792 789
793 memset(rxr->rx_pg_ring, 0, SW_RXPG_RING_SIZE *
794 bp->rx_max_pg_ring);
795 } 790 }
796 791
797 for (j = 0; j < bp->rx_max_pg_ring; j++) { 792 for (j = 0; j < bp->rx_max_pg_ring; j++) {
diff --git a/drivers/net/cxgb3/cxgb3_offload.c b/drivers/net/cxgb3/cxgb3_offload.c
index bcf07532953d..ef02aa68c926 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -1164,12 +1164,10 @@ static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new)
1164 */ 1164 */
1165void *cxgb_alloc_mem(unsigned long size) 1165void *cxgb_alloc_mem(unsigned long size)
1166{ 1166{
1167 void *p = kmalloc(size, GFP_KERNEL); 1167 void *p = kzalloc(size, GFP_KERNEL);
1168 1168
1169 if (!p) 1169 if (!p)
1170 p = vmalloc(size); 1170 p = vzalloc(size);
1171 if (p)
1172 memset(p, 0, size);
1173 return p; 1171 return p;
1174} 1172}
1175 1173
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
index f50bc98310f8..848f89d19fb7 100644
--- a/drivers/net/cxgb4/cxgb4_main.c
+++ b/drivers/net/cxgb4/cxgb4_main.c
@@ -868,12 +868,10 @@ out: release_firmware(fw);
868 */ 868 */
869void *t4_alloc_mem(size_t size) 869void *t4_alloc_mem(size_t size)
870{ 870{
871 void *p = kmalloc(size, GFP_KERNEL); 871 void *p = kzalloc(size, GFP_KERNEL);
872 872
873 if (!p) 873 if (!p)
874 p = vmalloc(size); 874 p = vzalloc(size);
875 if (p)
876 memset(p, 0, size);
877 return p; 875 return p;
878} 876}
879 877
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 4686c3983fc3..dcb7f82c2701 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -1425,13 +1425,12 @@ static int e1000_setup_tx_resources(struct e1000_adapter *adapter,
1425 int size; 1425 int size;
1426 1426
1427 size = sizeof(struct e1000_buffer) * txdr->count; 1427 size = sizeof(struct e1000_buffer) * txdr->count;
1428 txdr->buffer_info = vmalloc(size); 1428 txdr->buffer_info = vzalloc(size);
1429 if (!txdr->buffer_info) { 1429 if (!txdr->buffer_info) {
1430 e_err(probe, "Unable to allocate memory for the Tx descriptor " 1430 e_err(probe, "Unable to allocate memory for the Tx descriptor "
1431 "ring\n"); 1431 "ring\n");
1432 return -ENOMEM; 1432 return -ENOMEM;
1433 } 1433 }
1434 memset(txdr->buffer_info, 0, size);
1435 1434
1436 /* round up to nearest 4K */ 1435 /* round up to nearest 4K */
1437 1436
@@ -1621,13 +1620,12 @@ static int e1000_setup_rx_resources(struct e1000_adapter *adapter,
1621 int size, desc_len; 1620 int size, desc_len;
1622 1621
1623 size = sizeof(struct e1000_buffer) * rxdr->count; 1622 size = sizeof(struct e1000_buffer) * rxdr->count;
1624 rxdr->buffer_info = vmalloc(size); 1623 rxdr->buffer_info = vzalloc(size);
1625 if (!rxdr->buffer_info) { 1624 if (!rxdr->buffer_info) {
1626 e_err(probe, "Unable to allocate memory for the Rx descriptor " 1625 e_err(probe, "Unable to allocate memory for the Rx descriptor "
1627 "ring\n"); 1626 "ring\n");
1628 return -ENOMEM; 1627 return -ENOMEM;
1629 } 1628 }
1630 memset(rxdr->buffer_info, 0, size);
1631 1629
1632 desc_len = sizeof(struct e1000_rx_desc); 1630 desc_len = sizeof(struct e1000_rx_desc);
1633 1631
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 9b3f0a996b00..0adcb79e6386 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -2059,10 +2059,9 @@ int e1000e_setup_tx_resources(struct e1000_adapter *adapter)
2059 int err = -ENOMEM, size; 2059 int err = -ENOMEM, size;
2060 2060
2061 size = sizeof(struct e1000_buffer) * tx_ring->count; 2061 size = sizeof(struct e1000_buffer) * tx_ring->count;
2062 tx_ring->buffer_info = vmalloc(size); 2062 tx_ring->buffer_info = vzalloc(size);
2063 if (!tx_ring->buffer_info) 2063 if (!tx_ring->buffer_info)
2064 goto err; 2064 goto err;
2065 memset(tx_ring->buffer_info, 0, size);
2066 2065
2067 /* round up to nearest 4K */ 2066 /* round up to nearest 4K */
2068 tx_ring->size = tx_ring->count * sizeof(struct e1000_tx_desc); 2067 tx_ring->size = tx_ring->count * sizeof(struct e1000_tx_desc);
@@ -2095,10 +2094,9 @@ int e1000e_setup_rx_resources(struct e1000_adapter *adapter)
2095 int i, size, desc_len, err = -ENOMEM; 2094 int i, size, desc_len, err = -ENOMEM;
2096 2095
2097 size = sizeof(struct e1000_buffer) * rx_ring->count; 2096 size = sizeof(struct e1000_buffer) * rx_ring->count;
2098 rx_ring->buffer_info = vmalloc(size); 2097 rx_ring->buffer_info = vzalloc(size);
2099 if (!rx_ring->buffer_info) 2098 if (!rx_ring->buffer_info)
2100 goto err; 2099 goto err;
2101 memset(rx_ring->buffer_info, 0, size);
2102 2100
2103 for (i = 0; i < rx_ring->count; i++) { 2101 for (i = 0; i < rx_ring->count; i++) {
2104 buffer_info = &rx_ring->buffer_info[i]; 2102 buffer_info = &rx_ring->buffer_info[i];
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 182b2a7be8dc..a84c389d3db7 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -1496,12 +1496,10 @@ static int ehea_init_q_skba(struct ehea_q_skb_arr *q_skba, int max_q_entries)
1496{ 1496{
1497 int arr_size = sizeof(void *) * max_q_entries; 1497 int arr_size = sizeof(void *) * max_q_entries;
1498 1498
1499 q_skba->arr = vmalloc(arr_size); 1499 q_skba->arr = vzalloc(arr_size);
1500 if (!q_skba->arr) 1500 if (!q_skba->arr)
1501 return -ENOMEM; 1501 return -ENOMEM;
1502 1502
1503 memset(q_skba->arr, 0, arr_size);
1504
1505 q_skba->len = max_q_entries; 1503 q_skba->len = max_q_entries;
1506 q_skba->index = 0; 1504 q_skba->index = 0;
1507 q_skba->os_skbs = 0; 1505 q_skba->os_skbs = 0;
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 892d196f17ac..67ea262e482a 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -2436,10 +2436,9 @@ int igb_setup_tx_resources(struct igb_ring *tx_ring)
2436 int size; 2436 int size;
2437 2437
2438 size = sizeof(struct igb_buffer) * tx_ring->count; 2438 size = sizeof(struct igb_buffer) * tx_ring->count;
2439 tx_ring->buffer_info = vmalloc(size); 2439 tx_ring->buffer_info = vzalloc(size);
2440 if (!tx_ring->buffer_info) 2440 if (!tx_ring->buffer_info)
2441 goto err; 2441 goto err;
2442 memset(tx_ring->buffer_info, 0, size);
2443 2442
2444 /* round up to nearest 4K */ 2443 /* round up to nearest 4K */
2445 tx_ring->size = tx_ring->count * sizeof(union e1000_adv_tx_desc); 2444 tx_ring->size = tx_ring->count * sizeof(union e1000_adv_tx_desc);
@@ -2587,10 +2586,9 @@ int igb_setup_rx_resources(struct igb_ring *rx_ring)
2587 int size, desc_len; 2586 int size, desc_len;
2588 2587
2589 size = sizeof(struct igb_buffer) * rx_ring->count; 2588 size = sizeof(struct igb_buffer) * rx_ring->count;
2590 rx_ring->buffer_info = vmalloc(size); 2589 rx_ring->buffer_info = vzalloc(size);
2591 if (!rx_ring->buffer_info) 2590 if (!rx_ring->buffer_info)
2592 goto err; 2591 goto err;
2593 memset(rx_ring->buffer_info, 0, size);
2594 2592
2595 desc_len = sizeof(union e1000_adv_rx_desc); 2593 desc_len = sizeof(union e1000_adv_rx_desc);
2596 2594
diff --git a/drivers/net/igbvf/netdev.c b/drivers/net/igbvf/netdev.c
index 4c998b7726da..8dbde2397c10 100644
--- a/drivers/net/igbvf/netdev.c
+++ b/drivers/net/igbvf/netdev.c
@@ -430,10 +430,9 @@ int igbvf_setup_tx_resources(struct igbvf_adapter *adapter,
430 int size; 430 int size;
431 431
432 size = sizeof(struct igbvf_buffer) * tx_ring->count; 432 size = sizeof(struct igbvf_buffer) * tx_ring->count;
433 tx_ring->buffer_info = vmalloc(size); 433 tx_ring->buffer_info = vzalloc(size);
434 if (!tx_ring->buffer_info) 434 if (!tx_ring->buffer_info)
435 goto err; 435 goto err;
436 memset(tx_ring->buffer_info, 0, size);
437 436
438 /* round up to nearest 4K */ 437 /* round up to nearest 4K */
439 tx_ring->size = tx_ring->count * sizeof(union e1000_adv_tx_desc); 438 tx_ring->size = tx_ring->count * sizeof(union e1000_adv_tx_desc);
@@ -470,10 +469,9 @@ int igbvf_setup_rx_resources(struct igbvf_adapter *adapter,
470 int size, desc_len; 469 int size, desc_len;
471 470
472 size = sizeof(struct igbvf_buffer) * rx_ring->count; 471 size = sizeof(struct igbvf_buffer) * rx_ring->count;
473 rx_ring->buffer_info = vmalloc(size); 472 rx_ring->buffer_info = vzalloc(size);
474 if (!rx_ring->buffer_info) 473 if (!rx_ring->buffer_info)
475 goto err; 474 goto err;
476 memset(rx_ring->buffer_info, 0, size);
477 475
478 desc_len = sizeof(union e1000_adv_rx_desc); 476 desc_len = sizeof(union e1000_adv_rx_desc);
479 477
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index caa8192fff2a..211a1694667e 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -669,13 +669,12 @@ ixgb_setup_tx_resources(struct ixgb_adapter *adapter)
669 int size; 669 int size;
670 670
671 size = sizeof(struct ixgb_buffer) * txdr->count; 671 size = sizeof(struct ixgb_buffer) * txdr->count;
672 txdr->buffer_info = vmalloc(size); 672 txdr->buffer_info = vzalloc(size);
673 if (!txdr->buffer_info) { 673 if (!txdr->buffer_info) {
674 netif_err(adapter, probe, adapter->netdev, 674 netif_err(adapter, probe, adapter->netdev,
675 "Unable to allocate transmit descriptor ring memory\n"); 675 "Unable to allocate transmit descriptor ring memory\n");
676 return -ENOMEM; 676 return -ENOMEM;
677 } 677 }
678 memset(txdr->buffer_info, 0, size);
679 678
680 /* round up to nearest 4K */ 679 /* round up to nearest 4K */
681 680
@@ -759,13 +758,12 @@ ixgb_setup_rx_resources(struct ixgb_adapter *adapter)
759 int size; 758 int size;
760 759
761 size = sizeof(struct ixgb_buffer) * rxdr->count; 760 size = sizeof(struct ixgb_buffer) * rxdr->count;
762 rxdr->buffer_info = vmalloc(size); 761 rxdr->buffer_info = vzalloc(size);
763 if (!rxdr->buffer_info) { 762 if (!rxdr->buffer_info) {
764 netif_err(adapter, probe, adapter->netdev, 763 netif_err(adapter, probe, adapter->netdev,
765 "Unable to allocate receive descriptor ring\n"); 764 "Unable to allocate receive descriptor ring\n");
766 return -ENOMEM; 765 return -ENOMEM;
767 } 766 }
768 memset(rxdr->buffer_info, 0, size);
769 767
770 /* Round up to nearest 4K */ 768 /* Round up to nearest 4K */
771 769
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 025419567440..494cb57b700d 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -5181,12 +5181,11 @@ int ixgbe_setup_tx_resources(struct ixgbe_ring *tx_ring)
5181 int size; 5181 int size;
5182 5182
5183 size = sizeof(struct ixgbe_tx_buffer) * tx_ring->count; 5183 size = sizeof(struct ixgbe_tx_buffer) * tx_ring->count;
5184 tx_ring->tx_buffer_info = vmalloc_node(size, tx_ring->numa_node); 5184 tx_ring->tx_buffer_info = vzalloc_node(size, tx_ring->numa_node);
5185 if (!tx_ring->tx_buffer_info) 5185 if (!tx_ring->tx_buffer_info)
5186 tx_ring->tx_buffer_info = vmalloc(size); 5186 tx_ring->tx_buffer_info = vzalloc(size);
5187 if (!tx_ring->tx_buffer_info) 5187 if (!tx_ring->tx_buffer_info)
5188 goto err; 5188 goto err;
5189 memset(tx_ring->tx_buffer_info, 0, size);
5190 5189
5191 /* round up to nearest 4K */ 5190 /* round up to nearest 4K */
5192 tx_ring->size = tx_ring->count * sizeof(union ixgbe_adv_tx_desc); 5191 tx_ring->size = tx_ring->count * sizeof(union ixgbe_adv_tx_desc);
@@ -5246,12 +5245,11 @@ int ixgbe_setup_rx_resources(struct ixgbe_ring *rx_ring)
5246 int size; 5245 int size;
5247 5246
5248 size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count; 5247 size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count;
5249 rx_ring->rx_buffer_info = vmalloc_node(size, rx_ring->numa_node); 5248 rx_ring->rx_buffer_info = vzalloc_node(size, rx_ring->numa_node);
5250 if (!rx_ring->rx_buffer_info) 5249 if (!rx_ring->rx_buffer_info)
5251 rx_ring->rx_buffer_info = vmalloc(size); 5250 rx_ring->rx_buffer_info = vzalloc(size);
5252 if (!rx_ring->rx_buffer_info) 5251 if (!rx_ring->rx_buffer_info)
5253 goto err; 5252 goto err;
5254 memset(rx_ring->rx_buffer_info, 0, size);
5255 5253
5256 /* Round up to nearest 4K */ 5254 /* Round up to nearest 4K */
5257 rx_ring->size = rx_ring->count * sizeof(union ixgbe_adv_rx_desc); 5255 rx_ring->size = rx_ring->count * sizeof(union ixgbe_adv_rx_desc);
diff --git a/drivers/net/ixgbevf/ixgbevf_main.c b/drivers/net/ixgbevf/ixgbevf_main.c
index 5b8063cb4e6c..2216a3c8b12b 100644
--- a/drivers/net/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ixgbevf/ixgbevf_main.c
@@ -2489,10 +2489,9 @@ int ixgbevf_setup_tx_resources(struct ixgbevf_adapter *adapter,
2489 int size; 2489 int size;
2490 2490
2491 size = sizeof(struct ixgbevf_tx_buffer) * tx_ring->count; 2491 size = sizeof(struct ixgbevf_tx_buffer) * tx_ring->count;
2492 tx_ring->tx_buffer_info = vmalloc(size); 2492 tx_ring->tx_buffer_info = vzalloc(size);
2493 if (!tx_ring->tx_buffer_info) 2493 if (!tx_ring->tx_buffer_info)
2494 goto err; 2494 goto err;
2495 memset(tx_ring->tx_buffer_info, 0, size);
2496 2495
2497 /* round up to nearest 4K */ 2496 /* round up to nearest 4K */
2498 tx_ring->size = tx_ring->count * sizeof(union ixgbe_adv_tx_desc); 2497 tx_ring->size = tx_ring->count * sizeof(union ixgbe_adv_tx_desc);
@@ -2556,14 +2555,13 @@ int ixgbevf_setup_rx_resources(struct ixgbevf_adapter *adapter,
2556 int size; 2555 int size;
2557 2556
2558 size = sizeof(struct ixgbevf_rx_buffer) * rx_ring->count; 2557 size = sizeof(struct ixgbevf_rx_buffer) * rx_ring->count;
2559 rx_ring->rx_buffer_info = vmalloc(size); 2558 rx_ring->rx_buffer_info = vzalloc(size);
2560 if (!rx_ring->rx_buffer_info) { 2559 if (!rx_ring->rx_buffer_info) {
2561 hw_dbg(&adapter->hw, 2560 hw_dbg(&adapter->hw,
2562 "Unable to vmalloc buffer memory for " 2561 "Unable to vmalloc buffer memory for "
2563 "the receive descriptor ring\n"); 2562 "the receive descriptor ring\n");
2564 goto alloc_failed; 2563 goto alloc_failed;
2565 } 2564 }
2566 memset(rx_ring->rx_buffer_info, 0, size);
2567 2565
2568 /* Round up to nearest 4K */ 2566 /* Round up to nearest 4K */
2569 rx_ring->size = rx_ring->count * sizeof(union ixgbe_adv_rx_desc); 2567 rx_ring->size = rx_ring->count * sizeof(union ixgbe_adv_rx_desc);
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 95fe552aa279..f946de23fe76 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -214,13 +214,12 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter)
214 tx_ring->num_desc = adapter->num_txd; 214 tx_ring->num_desc = adapter->num_txd;
215 tx_ring->txq = netdev_get_tx_queue(netdev, 0); 215 tx_ring->txq = netdev_get_tx_queue(netdev, 0);
216 216
217 cmd_buf_arr = vmalloc(TX_BUFF_RINGSIZE(tx_ring)); 217 cmd_buf_arr = vzalloc(TX_BUFF_RINGSIZE(tx_ring));
218 if (cmd_buf_arr == NULL) { 218 if (cmd_buf_arr == NULL) {
219 dev_err(&pdev->dev, "%s: failed to allocate cmd buffer ring\n", 219 dev_err(&pdev->dev, "%s: failed to allocate cmd buffer ring\n",
220 netdev->name); 220 netdev->name);
221 goto err_out; 221 goto err_out;
222 } 222 }
223 memset(cmd_buf_arr, 0, TX_BUFF_RINGSIZE(tx_ring));
224 tx_ring->cmd_buf_arr = cmd_buf_arr; 223 tx_ring->cmd_buf_arr = cmd_buf_arr;
225 224
226 recv_ctx = &adapter->recv_ctx; 225 recv_ctx = &adapter->recv_ctx;
@@ -280,7 +279,7 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter)
280 279
281 } 280 }
282 rds_ring->rx_buf_arr = (struct netxen_rx_buffer *) 281 rds_ring->rx_buf_arr = (struct netxen_rx_buffer *)
283 vmalloc(RCV_BUFF_RINGSIZE(rds_ring)); 282 vzalloc(RCV_BUFF_RINGSIZE(rds_ring));
284 if (rds_ring->rx_buf_arr == NULL) { 283 if (rds_ring->rx_buf_arr == NULL) {
285 printk(KERN_ERR "%s: Failed to allocate " 284 printk(KERN_ERR "%s: Failed to allocate "
286 "rx buffer ring %d\n", 285 "rx buffer ring %d\n",
@@ -288,7 +287,6 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter)
288 /* free whatever was already allocated */ 287 /* free whatever was already allocated */
289 goto err_out; 288 goto err_out;
290 } 289 }
291 memset(rds_ring->rx_buf_arr, 0, RCV_BUFF_RINGSIZE(rds_ring));
292 INIT_LIST_HEAD(&rds_ring->free_list); 290 INIT_LIST_HEAD(&rds_ring->free_list);
293 /* 291 /*
294 * Now go through all of them, set reference handles 292 * Now go through all of them, set reference handles
diff --git a/drivers/net/pch_gbe/pch_gbe_main.c b/drivers/net/pch_gbe/pch_gbe_main.c
index 472056b47440..afb75066b14d 100644
--- a/drivers/net/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/pch_gbe/pch_gbe_main.c
@@ -1523,12 +1523,11 @@ int pch_gbe_setup_tx_resources(struct pch_gbe_adapter *adapter,
1523 int desNo; 1523 int desNo;
1524 1524
1525 size = (int)sizeof(struct pch_gbe_buffer) * tx_ring->count; 1525 size = (int)sizeof(struct pch_gbe_buffer) * tx_ring->count;
1526 tx_ring->buffer_info = vmalloc(size); 1526 tx_ring->buffer_info = vzalloc(size);
1527 if (!tx_ring->buffer_info) { 1527 if (!tx_ring->buffer_info) {
1528 pr_err("Unable to allocate memory for the buffer infomation\n"); 1528 pr_err("Unable to allocate memory for the buffer infomation\n");
1529 return -ENOMEM; 1529 return -ENOMEM;
1530 } 1530 }
1531 memset(tx_ring->buffer_info, 0, size);
1532 1531
1533 tx_ring->size = tx_ring->count * (int)sizeof(struct pch_gbe_tx_desc); 1532 tx_ring->size = tx_ring->count * (int)sizeof(struct pch_gbe_tx_desc);
1534 1533
@@ -1573,12 +1572,11 @@ int pch_gbe_setup_rx_resources(struct pch_gbe_adapter *adapter,
1573 int desNo; 1572 int desNo;
1574 1573
1575 size = (int)sizeof(struct pch_gbe_buffer) * rx_ring->count; 1574 size = (int)sizeof(struct pch_gbe_buffer) * rx_ring->count;
1576 rx_ring->buffer_info = vmalloc(size); 1575 rx_ring->buffer_info = vzalloc(size);
1577 if (!rx_ring->buffer_info) { 1576 if (!rx_ring->buffer_info) {
1578 pr_err("Unable to allocate memory for the receive descriptor ring\n"); 1577 pr_err("Unable to allocate memory for the receive descriptor ring\n");
1579 return -ENOMEM; 1578 return -ENOMEM;
1580 } 1579 }
1581 memset(rx_ring->buffer_info, 0, size);
1582 rx_ring->size = rx_ring->count * (int)sizeof(struct pch_gbe_rx_desc); 1580 rx_ring->size = rx_ring->count * (int)sizeof(struct pch_gbe_rx_desc);
1583 rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size, 1581 rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size,
1584 &rx_ring->dma, GFP_KERNEL); 1582 &rx_ring->dma, GFP_KERNEL);
diff --git a/drivers/net/pptp.c b/drivers/net/pptp.c
index ccbc91326bfa..7556a9224f72 100644
--- a/drivers/net/pptp.c
+++ b/drivers/net/pptp.c
@@ -673,8 +673,7 @@ static int __init pptp_init_module(void)
673 int err = 0; 673 int err = 0;
674 pr_info("PPTP driver version " PPTP_DRIVER_VERSION "\n"); 674 pr_info("PPTP driver version " PPTP_DRIVER_VERSION "\n");
675 675
676 callid_sock = __vmalloc((MAX_CALLID + 1) * sizeof(void *), 676 callid_sock = vzalloc((MAX_CALLID + 1) * sizeof(void *));
677 GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL);
678 if (!callid_sock) { 677 if (!callid_sock) {
679 pr_err("PPTP: cann't allocate memory\n"); 678 pr_err("PPTP: cann't allocate memory\n");
680 return -ENOMEM; 679 return -ENOMEM;
diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c
index 0d180c6e41fe..3f970187cfce 100644
--- a/drivers/net/qlcnic/qlcnic_init.c
+++ b/drivers/net/qlcnic/qlcnic_init.c
@@ -236,12 +236,11 @@ int qlcnic_alloc_sw_resources(struct qlcnic_adapter *adapter)
236 tx_ring->num_desc = adapter->num_txd; 236 tx_ring->num_desc = adapter->num_txd;
237 tx_ring->txq = netdev_get_tx_queue(netdev, 0); 237 tx_ring->txq = netdev_get_tx_queue(netdev, 0);
238 238
239 cmd_buf_arr = vmalloc(TX_BUFF_RINGSIZE(tx_ring)); 239 cmd_buf_arr = vzalloc(TX_BUFF_RINGSIZE(tx_ring));
240 if (cmd_buf_arr == NULL) { 240 if (cmd_buf_arr == NULL) {
241 dev_err(&netdev->dev, "failed to allocate cmd buffer ring\n"); 241 dev_err(&netdev->dev, "failed to allocate cmd buffer ring\n");
242 goto err_out; 242 goto err_out;
243 } 243 }
244 memset(cmd_buf_arr, 0, TX_BUFF_RINGSIZE(tx_ring));
245 tx_ring->cmd_buf_arr = cmd_buf_arr; 244 tx_ring->cmd_buf_arr = cmd_buf_arr;
246 245
247 recv_ctx = &adapter->recv_ctx; 246 recv_ctx = &adapter->recv_ctx;
@@ -276,13 +275,12 @@ int qlcnic_alloc_sw_resources(struct qlcnic_adapter *adapter)
276 break; 275 break;
277 } 276 }
278 rds_ring->rx_buf_arr = (struct qlcnic_rx_buffer *) 277 rds_ring->rx_buf_arr = (struct qlcnic_rx_buffer *)
279 vmalloc(RCV_BUFF_RINGSIZE(rds_ring)); 278 vzalloc(RCV_BUFF_RINGSIZE(rds_ring));
280 if (rds_ring->rx_buf_arr == NULL) { 279 if (rds_ring->rx_buf_arr == NULL) {
281 dev_err(&netdev->dev, "Failed to allocate " 280 dev_err(&netdev->dev, "Failed to allocate "
282 "rx buffer ring %d\n", ring); 281 "rx buffer ring %d\n", ring);
283 goto err_out; 282 goto err_out;
284 } 283 }
285 memset(rds_ring->rx_buf_arr, 0, RCV_BUFF_RINGSIZE(rds_ring));
286 INIT_LIST_HEAD(&rds_ring->free_list); 284 INIT_LIST_HEAD(&rds_ring->free_list);
287 /* 285 /*
288 * Now go through all of them, set reference handles 286 * Now go through all of them, set reference handles
diff --git a/drivers/net/sfc/filter.c b/drivers/net/sfc/filter.c
index 52cb6082b910..44500b54fd5f 100644
--- a/drivers/net/sfc/filter.c
+++ b/drivers/net/sfc/filter.c
@@ -428,10 +428,9 @@ int efx_probe_filters(struct efx_nic *efx)
428 GFP_KERNEL); 428 GFP_KERNEL);
429 if (!table->used_bitmap) 429 if (!table->used_bitmap)
430 goto fail; 430 goto fail;
431 table->spec = vmalloc(table->size * sizeof(*table->spec)); 431 table->spec = vzalloc(table->size * sizeof(*table->spec));
432 if (!table->spec) 432 if (!table->spec)
433 goto fail; 433 goto fail;
434 memset(table->spec, 0, table->size * sizeof(*table->spec));
435 } 434 }
436 435
437 return 0; 436 return 0;
diff --git a/drivers/net/vxge/vxge-config.c b/drivers/net/vxge/vxge-config.c
index 409c2e6053d0..44d3ddd37b3e 100644
--- a/drivers/net/vxge/vxge-config.c
+++ b/drivers/net/vxge/vxge-config.c
@@ -1220,13 +1220,12 @@ vxge_hw_device_initialize(
1220 goto exit; 1220 goto exit;
1221 1221
1222 hldev = (struct __vxge_hw_device *) 1222 hldev = (struct __vxge_hw_device *)
1223 vmalloc(sizeof(struct __vxge_hw_device)); 1223 vzalloc(sizeof(struct __vxge_hw_device));
1224 if (hldev == NULL) { 1224 if (hldev == NULL) {
1225 status = VXGE_HW_ERR_OUT_OF_MEMORY; 1225 status = VXGE_HW_ERR_OUT_OF_MEMORY;
1226 goto exit; 1226 goto exit;
1227 } 1227 }
1228 1228
1229 memset(hldev, 0, sizeof(struct __vxge_hw_device));
1230 hldev->magic = VXGE_HW_DEVICE_MAGIC; 1229 hldev->magic = VXGE_HW_DEVICE_MAGIC;
1231 1230
1232 vxge_hw_device_debug_set(hldev, VXGE_ERR, VXGE_COMPONENT_ALL); 1231 vxge_hw_device_debug_set(hldev, VXGE_ERR, VXGE_COMPONENT_ALL);
@@ -2064,15 +2063,12 @@ __vxge_hw_mempool_grow(struct vxge_hw_mempool *mempool, u32 num_allocate,
2064 * allocate new memblock and its private part at once. 2063 * allocate new memblock and its private part at once.
2065 * This helps to minimize memory usage a lot. */ 2064 * This helps to minimize memory usage a lot. */
2066 mempool->memblocks_priv_arr[i] = 2065 mempool->memblocks_priv_arr[i] =
2067 vmalloc(mempool->items_priv_size * n_items); 2066 vzalloc(mempool->items_priv_size * n_items);
2068 if (mempool->memblocks_priv_arr[i] == NULL) { 2067 if (mempool->memblocks_priv_arr[i] == NULL) {
2069 status = VXGE_HW_ERR_OUT_OF_MEMORY; 2068 status = VXGE_HW_ERR_OUT_OF_MEMORY;
2070 goto exit; 2069 goto exit;
2071 } 2070 }
2072 2071
2073 memset(mempool->memblocks_priv_arr[i], 0,
2074 mempool->items_priv_size * n_items);
2075
2076 /* allocate DMA-capable memblock */ 2072 /* allocate DMA-capable memblock */
2077 mempool->memblocks_arr[i] = 2073 mempool->memblocks_arr[i] =
2078 __vxge_hw_blockpool_malloc(mempool->devh, 2074 __vxge_hw_blockpool_malloc(mempool->devh,
@@ -2145,12 +2141,11 @@ __vxge_hw_mempool_create(
2145 } 2141 }
2146 2142
2147 mempool = (struct vxge_hw_mempool *) 2143 mempool = (struct vxge_hw_mempool *)
2148 vmalloc(sizeof(struct vxge_hw_mempool)); 2144 vzalloc(sizeof(struct vxge_hw_mempool));
2149 if (mempool == NULL) { 2145 if (mempool == NULL) {
2150 status = VXGE_HW_ERR_OUT_OF_MEMORY; 2146 status = VXGE_HW_ERR_OUT_OF_MEMORY;
2151 goto exit; 2147 goto exit;
2152 } 2148 }
2153 memset(mempool, 0, sizeof(struct vxge_hw_mempool));
2154 2149
2155 mempool->devh = devh; 2150 mempool->devh = devh;
2156 mempool->memblock_size = memblock_size; 2151 mempool->memblock_size = memblock_size;
@@ -2170,31 +2165,27 @@ __vxge_hw_mempool_create(
2170 2165
2171 /* allocate array of memblocks */ 2166 /* allocate array of memblocks */
2172 mempool->memblocks_arr = 2167 mempool->memblocks_arr =
2173 (void **) vmalloc(sizeof(void *) * mempool->memblocks_max); 2168 (void **) vzalloc(sizeof(void *) * mempool->memblocks_max);
2174 if (mempool->memblocks_arr == NULL) { 2169 if (mempool->memblocks_arr == NULL) {
2175 __vxge_hw_mempool_destroy(mempool); 2170 __vxge_hw_mempool_destroy(mempool);
2176 status = VXGE_HW_ERR_OUT_OF_MEMORY; 2171 status = VXGE_HW_ERR_OUT_OF_MEMORY;
2177 mempool = NULL; 2172 mempool = NULL;
2178 goto exit; 2173 goto exit;
2179 } 2174 }
2180 memset(mempool->memblocks_arr, 0,
2181 sizeof(void *) * mempool->memblocks_max);
2182 2175
2183 /* allocate array of private parts of items per memblocks */ 2176 /* allocate array of private parts of items per memblocks */
2184 mempool->memblocks_priv_arr = 2177 mempool->memblocks_priv_arr =
2185 (void **) vmalloc(sizeof(void *) * mempool->memblocks_max); 2178 (void **) vzalloc(sizeof(void *) * mempool->memblocks_max);
2186 if (mempool->memblocks_priv_arr == NULL) { 2179 if (mempool->memblocks_priv_arr == NULL) {
2187 __vxge_hw_mempool_destroy(mempool); 2180 __vxge_hw_mempool_destroy(mempool);
2188 status = VXGE_HW_ERR_OUT_OF_MEMORY; 2181 status = VXGE_HW_ERR_OUT_OF_MEMORY;
2189 mempool = NULL; 2182 mempool = NULL;
2190 goto exit; 2183 goto exit;
2191 } 2184 }
2192 memset(mempool->memblocks_priv_arr, 0,
2193 sizeof(void *) * mempool->memblocks_max);
2194 2185
2195 /* allocate array of memblocks DMA objects */ 2186 /* allocate array of memblocks DMA objects */
2196 mempool->memblocks_dma_arr = (struct vxge_hw_mempool_dma *) 2187 mempool->memblocks_dma_arr = (struct vxge_hw_mempool_dma *)
2197 vmalloc(sizeof(struct vxge_hw_mempool_dma) * 2188 vzalloc(sizeof(struct vxge_hw_mempool_dma) *
2198 mempool->memblocks_max); 2189 mempool->memblocks_max);
2199 2190
2200 if (mempool->memblocks_dma_arr == NULL) { 2191 if (mempool->memblocks_dma_arr == NULL) {
@@ -2203,20 +2194,16 @@ __vxge_hw_mempool_create(
2203 mempool = NULL; 2194 mempool = NULL;
2204 goto exit; 2195 goto exit;
2205 } 2196 }
2206 memset(mempool->memblocks_dma_arr, 0,
2207 sizeof(struct vxge_hw_mempool_dma) *
2208 mempool->memblocks_max);
2209 2197
2210 /* allocate hash array of items */ 2198 /* allocate hash array of items */
2211 mempool->items_arr = 2199 mempool->items_arr =
2212 (void **) vmalloc(sizeof(void *) * mempool->items_max); 2200 (void **) vzalloc(sizeof(void *) * mempool->items_max);
2213 if (mempool->items_arr == NULL) { 2201 if (mempool->items_arr == NULL) {
2214 __vxge_hw_mempool_destroy(mempool); 2202 __vxge_hw_mempool_destroy(mempool);
2215 status = VXGE_HW_ERR_OUT_OF_MEMORY; 2203 status = VXGE_HW_ERR_OUT_OF_MEMORY;
2216 mempool = NULL; 2204 mempool = NULL;
2217 goto exit; 2205 goto exit;
2218 } 2206 }
2219 memset(mempool->items_arr, 0, sizeof(void *) * mempool->items_max);
2220 2207
2221 /* calculate initial number of memblocks */ 2208 /* calculate initial number of memblocks */
2222 memblocks_to_allocate = (mempool->items_initial + 2209 memblocks_to_allocate = (mempool->items_initial +
@@ -4272,14 +4259,12 @@ vxge_hw_vpath_open(struct __vxge_hw_device *hldev,
4272 goto vpath_open_exit1; 4259 goto vpath_open_exit1;
4273 4260
4274 vp = (struct __vxge_hw_vpath_handle *) 4261 vp = (struct __vxge_hw_vpath_handle *)
4275 vmalloc(sizeof(struct __vxge_hw_vpath_handle)); 4262 vzalloc(sizeof(struct __vxge_hw_vpath_handle));
4276 if (vp == NULL) { 4263 if (vp == NULL) {
4277 status = VXGE_HW_ERR_OUT_OF_MEMORY; 4264 status = VXGE_HW_ERR_OUT_OF_MEMORY;
4278 goto vpath_open_exit2; 4265 goto vpath_open_exit2;
4279 } 4266 }
4280 4267
4281 memset(vp, 0, sizeof(struct __vxge_hw_vpath_handle));
4282
4283 vp->vpath = vpath; 4268 vp->vpath = vpath;
4284 4269
4285 if (vpath->vp_config->fifo.enable == VXGE_HW_FIFO_ENABLE) { 4270 if (vpath->vp_config->fifo.enable == VXGE_HW_FIFO_ENABLE) {