diff options
author | Joe Perches <joe@perches.com> | 2013-03-15 03:23:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-17 12:50:24 -0400 |
commit | 1f9061d27d3d2028805549c4a306324a48209057 (patch) | |
tree | 7cfb1a92933f5a9bba6745b68b6a964d9e757ef9 | |
parent | 7f9421c264f8a6e6137027a45ae576517f66fa56 (diff) |
drivers:net: dma_alloc_coherent: use __GFP_ZERO instead of memset(, 0)
Reduce the number of calls required to alloc
a zeroed block of memory.
Trivially reduces overall object size.
Other changes around these removals
o Neaten call argument alignment
o Remove an unnecessary OOM message after dma_alloc_coherent failure
o Remove unnecessary gfp_t stack variable
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
38 files changed, 104 insertions, 168 deletions
diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c index 3a9fbacc3729..269295403fc4 100644 --- a/drivers/net/ethernet/aeroflex/greth.c +++ b/drivers/net/ethernet/aeroflex/greth.c | |||
@@ -1466,25 +1466,21 @@ static int greth_of_probe(struct platform_device *ofdev) | |||
1466 | /* Allocate TX descriptor ring in coherent memory */ | 1466 | /* Allocate TX descriptor ring in coherent memory */ |
1467 | greth->tx_bd_base = dma_alloc_coherent(greth->dev, 1024, | 1467 | greth->tx_bd_base = dma_alloc_coherent(greth->dev, 1024, |
1468 | &greth->tx_bd_base_phys, | 1468 | &greth->tx_bd_base_phys, |
1469 | GFP_KERNEL); | 1469 | GFP_KERNEL | __GFP_ZERO); |
1470 | if (!greth->tx_bd_base) { | 1470 | if (!greth->tx_bd_base) { |
1471 | err = -ENOMEM; | 1471 | err = -ENOMEM; |
1472 | goto error3; | 1472 | goto error3; |
1473 | } | 1473 | } |
1474 | 1474 | ||
1475 | memset(greth->tx_bd_base, 0, 1024); | ||
1476 | |||
1477 | /* Allocate RX descriptor ring in coherent memory */ | 1475 | /* Allocate RX descriptor ring in coherent memory */ |
1478 | greth->rx_bd_base = dma_alloc_coherent(greth->dev, 1024, | 1476 | greth->rx_bd_base = dma_alloc_coherent(greth->dev, 1024, |
1479 | &greth->rx_bd_base_phys, | 1477 | &greth->rx_bd_base_phys, |
1480 | GFP_KERNEL); | 1478 | GFP_KERNEL | __GFP_ZERO); |
1481 | if (!greth->rx_bd_base) { | 1479 | if (!greth->rx_bd_base) { |
1482 | err = -ENOMEM; | 1480 | err = -ENOMEM; |
1483 | goto error4; | 1481 | goto error4; |
1484 | } | 1482 | } |
1485 | 1483 | ||
1486 | memset(greth->rx_bd_base, 0, 1024); | ||
1487 | |||
1488 | /* Get MAC address from: module param, OF property or ID prom */ | 1484 | /* Get MAC address from: module param, OF property or ID prom */ |
1489 | for (i = 0; i < 6; i++) { | 1485 | for (i = 0; i < 6; i++) { |
1490 | if (macaddr[i] != 0) | 1486 | if (macaddr[i] != 0) |
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c index 79cf620ab449..0b3e23ec37f7 100644 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c | |||
@@ -862,25 +862,25 @@ static int bcm_enet_open(struct net_device *dev) | |||
862 | 862 | ||
863 | /* allocate rx dma ring */ | 863 | /* allocate rx dma ring */ |
864 | size = priv->rx_ring_size * sizeof(struct bcm_enet_desc); | 864 | size = priv->rx_ring_size * sizeof(struct bcm_enet_desc); |
865 | p = dma_alloc_coherent(kdev, size, &priv->rx_desc_dma, GFP_KERNEL); | 865 | p = dma_alloc_coherent(kdev, size, &priv->rx_desc_dma, |
866 | GFP_KERNEL | __GFP_ZERO); | ||
866 | if (!p) { | 867 | if (!p) { |
867 | ret = -ENOMEM; | 868 | ret = -ENOMEM; |
868 | goto out_freeirq_tx; | 869 | goto out_freeirq_tx; |
869 | } | 870 | } |
870 | 871 | ||
871 | memset(p, 0, size); | ||
872 | priv->rx_desc_alloc_size = size; | 872 | priv->rx_desc_alloc_size = size; |
873 | priv->rx_desc_cpu = p; | 873 | priv->rx_desc_cpu = p; |
874 | 874 | ||
875 | /* allocate tx dma ring */ | 875 | /* allocate tx dma ring */ |
876 | size = priv->tx_ring_size * sizeof(struct bcm_enet_desc); | 876 | size = priv->tx_ring_size * sizeof(struct bcm_enet_desc); |
877 | p = dma_alloc_coherent(kdev, size, &priv->tx_desc_dma, GFP_KERNEL); | 877 | p = dma_alloc_coherent(kdev, size, &priv->tx_desc_dma, |
878 | GFP_KERNEL | __GFP_ZERO); | ||
878 | if (!p) { | 879 | if (!p) { |
879 | ret = -ENOMEM; | 880 | ret = -ENOMEM; |
880 | goto out_free_rx_ring; | 881 | goto out_free_rx_ring; |
881 | } | 882 | } |
882 | 883 | ||
883 | memset(p, 0, size); | ||
884 | priv->tx_desc_alloc_size = size; | 884 | priv->tx_desc_alloc_size = size; |
885 | priv->tx_desc_cpu = p; | 885 | priv->tx_desc_cpu = p; |
886 | 886 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index 2f0ba8f2fd6c..e709296e3b85 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c | |||
@@ -854,12 +854,11 @@ bnx2_alloc_mem(struct bnx2 *bp) | |||
854 | sizeof(struct statistics_block); | 854 | sizeof(struct statistics_block); |
855 | 855 | ||
856 | status_blk = dma_alloc_coherent(&bp->pdev->dev, bp->status_stats_size, | 856 | status_blk = dma_alloc_coherent(&bp->pdev->dev, bp->status_stats_size, |
857 | &bp->status_blk_mapping, GFP_KERNEL); | 857 | &bp->status_blk_mapping, |
858 | GFP_KERNEL | __GFP_ZERO); | ||
858 | if (status_blk == NULL) | 859 | if (status_blk == NULL) |
859 | goto alloc_mem_err; | 860 | goto alloc_mem_err; |
860 | 861 | ||
861 | memset(status_blk, 0, bp->status_stats_size); | ||
862 | |||
863 | bnapi = &bp->bnx2_napi[0]; | 862 | bnapi = &bp->bnx2_napi[0]; |
864 | bnapi->status_blk.msi = status_blk; | 863 | bnapi->status_blk.msi = status_blk; |
865 | bnapi->hw_tx_cons_ptr = | 864 | bnapi->hw_tx_cons_ptr = |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h index f865ad5002f6..9e8d1955dfcf 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | |||
@@ -1946,12 +1946,9 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms, | |||
1946 | void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id, | 1946 | void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id, |
1947 | bool is_pf); | 1947 | bool is_pf); |
1948 | 1948 | ||
1949 | #define BNX2X_ILT_ZALLOC(x, y, size) \ | 1949 | #define BNX2X_ILT_ZALLOC(x, y, size) \ |
1950 | do { \ | 1950 | x = dma_alloc_coherent(&bp->pdev->dev, size, y, \ |
1951 | x = dma_alloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \ | 1951 | GFP_KERNEL | __GFP_ZERO) |
1952 | if (x) \ | ||
1953 | memset(x, 0, size); \ | ||
1954 | } while (0) | ||
1955 | 1952 | ||
1956 | #define BNX2X_ILT_FREE(x, y, size) \ | 1953 | #define BNX2X_ILT_FREE(x, y, size) \ |
1957 | do { \ | 1954 | do { \ |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h index 4620fa5666e5..8f9637279f12 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | |||
@@ -50,13 +50,13 @@ extern int int_mode; | |||
50 | } \ | 50 | } \ |
51 | } while (0) | 51 | } while (0) |
52 | 52 | ||
53 | #define BNX2X_PCI_ALLOC(x, y, size) \ | 53 | #define BNX2X_PCI_ALLOC(x, y, size) \ |
54 | do { \ | 54 | do { \ |
55 | x = dma_alloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \ | 55 | x = dma_alloc_coherent(&bp->pdev->dev, size, y, \ |
56 | if (x == NULL) \ | 56 | GFP_KERNEL | __GFP_ZERO); \ |
57 | goto alloc_mem_err; \ | 57 | if (x == NULL) \ |
58 | memset((void *)x, 0, size); \ | 58 | goto alloc_mem_err; \ |
59 | } while (0) | 59 | } while (0) |
60 | 60 | ||
61 | #define BNX2X_ALLOC(x, size) \ | 61 | #define BNX2X_ALLOC(x, size) \ |
62 | do { \ | 62 | do { \ |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 0c1a2ef163a5..7794883f5973 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -8172,11 +8172,9 @@ static int tg3_mem_rx_acquire(struct tg3 *tp) | |||
8172 | tnapi->rx_rcb = dma_alloc_coherent(&tp->pdev->dev, | 8172 | tnapi->rx_rcb = dma_alloc_coherent(&tp->pdev->dev, |
8173 | TG3_RX_RCB_RING_BYTES(tp), | 8173 | TG3_RX_RCB_RING_BYTES(tp), |
8174 | &tnapi->rx_rcb_mapping, | 8174 | &tnapi->rx_rcb_mapping, |
8175 | GFP_KERNEL); | 8175 | GFP_KERNEL | __GFP_ZERO); |
8176 | if (!tnapi->rx_rcb) | 8176 | if (!tnapi->rx_rcb) |
8177 | goto err_out; | 8177 | goto err_out; |
8178 | |||
8179 | memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp)); | ||
8180 | } | 8178 | } |
8181 | 8179 | ||
8182 | return 0; | 8180 | return 0; |
@@ -8226,12 +8224,10 @@ static int tg3_alloc_consistent(struct tg3 *tp) | |||
8226 | tp->hw_stats = dma_alloc_coherent(&tp->pdev->dev, | 8224 | tp->hw_stats = dma_alloc_coherent(&tp->pdev->dev, |
8227 | sizeof(struct tg3_hw_stats), | 8225 | sizeof(struct tg3_hw_stats), |
8228 | &tp->stats_mapping, | 8226 | &tp->stats_mapping, |
8229 | GFP_KERNEL); | 8227 | GFP_KERNEL | __GFP_ZERO); |
8230 | if (!tp->hw_stats) | 8228 | if (!tp->hw_stats) |
8231 | goto err_out; | 8229 | goto err_out; |
8232 | 8230 | ||
8233 | memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats)); | ||
8234 | |||
8235 | for (i = 0; i < tp->irq_cnt; i++) { | 8231 | for (i = 0; i < tp->irq_cnt; i++) { |
8236 | struct tg3_napi *tnapi = &tp->napi[i]; | 8232 | struct tg3_napi *tnapi = &tp->napi[i]; |
8237 | struct tg3_hw_status *sblk; | 8233 | struct tg3_hw_status *sblk; |
@@ -8239,11 +8235,10 @@ static int tg3_alloc_consistent(struct tg3 *tp) | |||
8239 | tnapi->hw_status = dma_alloc_coherent(&tp->pdev->dev, | 8235 | tnapi->hw_status = dma_alloc_coherent(&tp->pdev->dev, |
8240 | TG3_HW_STATUS_SIZE, | 8236 | TG3_HW_STATUS_SIZE, |
8241 | &tnapi->status_mapping, | 8237 | &tnapi->status_mapping, |
8242 | GFP_KERNEL); | 8238 | GFP_KERNEL | __GFP_ZERO); |
8243 | if (!tnapi->hw_status) | 8239 | if (!tnapi->hw_status) |
8244 | goto err_out; | 8240 | goto err_out; |
8245 | 8241 | ||
8246 | memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE); | ||
8247 | sblk = tnapi->hw_status; | 8242 | sblk = tnapi->hw_status; |
8248 | 8243 | ||
8249 | if (tg3_flag(tp, ENABLE_RSS)) { | 8244 | if (tg3_flag(tp, ENABLE_RSS)) { |
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 7cce42dc2f20..d588f842d557 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c | |||
@@ -1264,9 +1264,8 @@ bnad_mem_alloc(struct bnad *bnad, | |||
1264 | mem_info->mdl[i].len = mem_info->len; | 1264 | mem_info->mdl[i].len = mem_info->len; |
1265 | mem_info->mdl[i].kva = | 1265 | mem_info->mdl[i].kva = |
1266 | dma_alloc_coherent(&bnad->pcidev->dev, | 1266 | dma_alloc_coherent(&bnad->pcidev->dev, |
1267 | mem_info->len, &dma_pa, | 1267 | mem_info->len, &dma_pa, |
1268 | GFP_KERNEL); | 1268 | GFP_KERNEL); |
1269 | |||
1270 | if (mem_info->mdl[i].kva == NULL) | 1269 | if (mem_info->mdl[i].kva == NULL) |
1271 | goto err_return; | 1270 | goto err_return; |
1272 | 1271 | ||
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 2dfa205c5b99..536afa2fb94c 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -146,10 +146,9 @@ static int be_queue_alloc(struct be_adapter *adapter, struct be_queue_info *q, | |||
146 | q->entry_size = entry_size; | 146 | q->entry_size = entry_size; |
147 | mem->size = len * entry_size; | 147 | mem->size = len * entry_size; |
148 | mem->va = dma_alloc_coherent(&adapter->pdev->dev, mem->size, &mem->dma, | 148 | mem->va = dma_alloc_coherent(&adapter->pdev->dev, mem->size, &mem->dma, |
149 | GFP_KERNEL); | 149 | GFP_KERNEL | __GFP_ZERO); |
150 | if (!mem->va) | 150 | if (!mem->va) |
151 | return -ENOMEM; | 151 | return -ENOMEM; |
152 | memset(mem->va, 0, mem->size); | ||
153 | return 0; | 152 | return 0; |
154 | } | 153 | } |
155 | 154 | ||
@@ -2569,10 +2568,9 @@ static int be_setup_wol(struct be_adapter *adapter, bool enable) | |||
2569 | 2568 | ||
2570 | cmd.size = sizeof(struct be_cmd_req_acpi_wol_magic_config); | 2569 | cmd.size = sizeof(struct be_cmd_req_acpi_wol_magic_config); |
2571 | cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, | 2570 | cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, |
2572 | GFP_KERNEL); | 2571 | GFP_KERNEL | __GFP_ZERO); |
2573 | if (cmd.va == NULL) | 2572 | if (cmd.va == NULL) |
2574 | return -1; | 2573 | return -1; |
2575 | memset(cmd.va, 0, cmd.size); | ||
2576 | 2574 | ||
2577 | if (enable) { | 2575 | if (enable) { |
2578 | status = pci_write_config_dword(adapter->pdev, | 2576 | status = pci_write_config_dword(adapter->pdev, |
@@ -3794,12 +3792,13 @@ static int be_ctrl_init(struct be_adapter *adapter) | |||
3794 | 3792 | ||
3795 | rx_filter->size = sizeof(struct be_cmd_req_rx_filter); | 3793 | rx_filter->size = sizeof(struct be_cmd_req_rx_filter); |
3796 | rx_filter->va = dma_alloc_coherent(&adapter->pdev->dev, rx_filter->size, | 3794 | rx_filter->va = dma_alloc_coherent(&adapter->pdev->dev, rx_filter->size, |
3797 | &rx_filter->dma, GFP_KERNEL); | 3795 | &rx_filter->dma, |
3796 | GFP_KERNEL | __GFP_ZERO); | ||
3798 | if (rx_filter->va == NULL) { | 3797 | if (rx_filter->va == NULL) { |
3799 | status = -ENOMEM; | 3798 | status = -ENOMEM; |
3800 | goto free_mbox; | 3799 | goto free_mbox; |
3801 | } | 3800 | } |
3802 | memset(rx_filter->va, 0, rx_filter->size); | 3801 | |
3803 | mutex_init(&adapter->mbox_lock); | 3802 | mutex_init(&adapter->mbox_lock); |
3804 | spin_lock_init(&adapter->mcc_lock); | 3803 | spin_lock_init(&adapter->mcc_lock); |
3805 | spin_lock_init(&adapter->mcc_cq_lock); | 3804 | spin_lock_init(&adapter->mcc_cq_lock); |
@@ -3841,10 +3840,9 @@ static int be_stats_init(struct be_adapter *adapter) | |||
3841 | cmd->size = sizeof(struct be_cmd_req_get_stats_v1); | 3840 | cmd->size = sizeof(struct be_cmd_req_get_stats_v1); |
3842 | 3841 | ||
3843 | cmd->va = dma_alloc_coherent(&adapter->pdev->dev, cmd->size, &cmd->dma, | 3842 | cmd->va = dma_alloc_coherent(&adapter->pdev->dev, cmd->size, &cmd->dma, |
3844 | GFP_KERNEL); | 3843 | GFP_KERNEL | __GFP_ZERO); |
3845 | if (cmd->va == NULL) | 3844 | if (cmd->va == NULL) |
3846 | return -1; | 3845 | return -1; |
3847 | memset(cmd->va, 0, cmd->size); | ||
3848 | return 0; | 3846 | return 0; |
3849 | } | 3847 | } |
3850 | 3848 | ||
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index 7c361d1db94c..0e817e6084e9 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c | |||
@@ -780,12 +780,11 @@ static int ftgmac100_alloc_buffers(struct ftgmac100 *priv) | |||
780 | 780 | ||
781 | priv->descs = dma_alloc_coherent(priv->dev, | 781 | priv->descs = dma_alloc_coherent(priv->dev, |
782 | sizeof(struct ftgmac100_descs), | 782 | sizeof(struct ftgmac100_descs), |
783 | &priv->descs_dma_addr, GFP_KERNEL); | 783 | &priv->descs_dma_addr, |
784 | GFP_KERNEL | __GFP_ZERO); | ||
784 | if (!priv->descs) | 785 | if (!priv->descs) |
785 | return -ENOMEM; | 786 | return -ENOMEM; |
786 | 787 | ||
787 | memset(priv->descs, 0, sizeof(struct ftgmac100_descs)); | ||
788 | |||
789 | /* initialize RX ring */ | 788 | /* initialize RX ring */ |
790 | ftgmac100_rxdes_set_end_of_ring(&priv->descs->rxdes[RX_QUEUE_ENTRIES - 1]); | 789 | ftgmac100_rxdes_set_end_of_ring(&priv->descs->rxdes[RX_QUEUE_ENTRIES - 1]); |
791 | 790 | ||
diff --git a/drivers/net/ethernet/faraday/ftmac100.c b/drivers/net/ethernet/faraday/ftmac100.c index b5ea8fbd8a76..a6eda8d83138 100644 --- a/drivers/net/ethernet/faraday/ftmac100.c +++ b/drivers/net/ethernet/faraday/ftmac100.c | |||
@@ -732,13 +732,13 @@ static int ftmac100_alloc_buffers(struct ftmac100 *priv) | |||
732 | { | 732 | { |
733 | int i; | 733 | int i; |
734 | 734 | ||
735 | priv->descs = dma_alloc_coherent(priv->dev, sizeof(struct ftmac100_descs), | 735 | priv->descs = dma_alloc_coherent(priv->dev, |
736 | &priv->descs_dma_addr, GFP_KERNEL); | 736 | sizeof(struct ftmac100_descs), |
737 | &priv->descs_dma_addr, | ||
738 | GFP_KERNEL | __GFP_ZERO); | ||
737 | if (!priv->descs) | 739 | if (!priv->descs) |
738 | return -ENOMEM; | 740 | return -ENOMEM; |
739 | 741 | ||
740 | memset(priv->descs, 0, sizeof(struct ftmac100_descs)); | ||
741 | |||
742 | /* initialize RX ring */ | 742 | /* initialize RX ring */ |
743 | ftmac100_rxdes_set_end_of_ring(&priv->descs->rxdes[RX_QUEUE_ENTRIES - 1]); | 743 | ftmac100_rxdes_set_end_of_ring(&priv->descs->rxdes[RX_QUEUE_ENTRIES - 1]); |
744 | 744 | ||
diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm/emac/mal.c index cc2db5c04d9c..610ed223d1db 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c | |||
@@ -638,12 +638,11 @@ static int mal_probe(struct platform_device *ofdev) | |||
638 | (NUM_TX_BUFF * mal->num_tx_chans + | 638 | (NUM_TX_BUFF * mal->num_tx_chans + |
639 | NUM_RX_BUFF * mal->num_rx_chans); | 639 | NUM_RX_BUFF * mal->num_rx_chans); |
640 | mal->bd_virt = dma_alloc_coherent(&ofdev->dev, bd_size, &mal->bd_dma, | 640 | mal->bd_virt = dma_alloc_coherent(&ofdev->dev, bd_size, &mal->bd_dma, |
641 | GFP_KERNEL); | 641 | GFP_KERNEL | __GFP_ZERO); |
642 | if (mal->bd_virt == NULL) { | 642 | if (mal->bd_virt == NULL) { |
643 | err = -ENOMEM; | 643 | err = -ENOMEM; |
644 | goto fail_unmap; | 644 | goto fail_unmap; |
645 | } | 645 | } |
646 | memset(mal->bd_virt, 0, bd_size); | ||
647 | 646 | ||
648 | for (i = 0; i < mal->num_tx_chans; ++i) | 647 | for (i = 0; i < mal->num_tx_chans; ++i) |
649 | set_mal_dcrn(mal, MAL_TXCTPR(i), mal->bd_dma + | 648 | set_mal_dcrn(mal, MAL_TXCTPR(i), mal->bd_dma + |
diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c index 43462d596a4e..a9f9c7906769 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c +++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c | |||
@@ -1020,12 +1020,11 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1020 | txdr->size = txdr->count * sizeof(struct e1000_tx_desc); | 1020 | txdr->size = txdr->count * sizeof(struct e1000_tx_desc); |
1021 | txdr->size = ALIGN(txdr->size, 4096); | 1021 | txdr->size = ALIGN(txdr->size, 4096); |
1022 | txdr->desc = dma_alloc_coherent(&pdev->dev, txdr->size, &txdr->dma, | 1022 | txdr->desc = dma_alloc_coherent(&pdev->dev, txdr->size, &txdr->dma, |
1023 | GFP_KERNEL); | 1023 | GFP_KERNEL | __GFP_ZERO); |
1024 | if (!txdr->desc) { | 1024 | if (!txdr->desc) { |
1025 | ret_val = 2; | 1025 | ret_val = 2; |
1026 | goto err_nomem; | 1026 | goto err_nomem; |
1027 | } | 1027 | } |
1028 | memset(txdr->desc, 0, txdr->size); | ||
1029 | txdr->next_to_use = txdr->next_to_clean = 0; | 1028 | txdr->next_to_use = txdr->next_to_clean = 0; |
1030 | 1029 | ||
1031 | ew32(TDBAL, ((u64)txdr->dma & 0x00000000FFFFFFFF)); | 1030 | ew32(TDBAL, ((u64)txdr->dma & 0x00000000FFFFFFFF)); |
@@ -1075,12 +1074,11 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1075 | 1074 | ||
1076 | rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc); | 1075 | rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc); |
1077 | rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma, | 1076 | rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma, |
1078 | GFP_KERNEL); | 1077 | GFP_KERNEL | __GFP_ZERO); |
1079 | if (!rxdr->desc) { | 1078 | if (!rxdr->desc) { |
1080 | ret_val = 5; | 1079 | ret_val = 5; |
1081 | goto err_nomem; | 1080 | goto err_nomem; |
1082 | } | 1081 | } |
1083 | memset(rxdr->desc, 0, rxdr->size); | ||
1084 | rxdr->next_to_use = rxdr->next_to_clean = 0; | 1082 | rxdr->next_to_use = rxdr->next_to_clean = 0; |
1085 | 1083 | ||
1086 | rctl = er32(RCTL); | 1084 | rctl = er32(RCTL); |
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c index d60cd4393415..bea46bb26061 100644 --- a/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/drivers/net/ethernet/intel/igbvf/netdev.c | |||
@@ -447,7 +447,6 @@ int igbvf_setup_tx_resources(struct igbvf_adapter *adapter, | |||
447 | 447 | ||
448 | tx_ring->desc = dma_alloc_coherent(&pdev->dev, tx_ring->size, | 448 | tx_ring->desc = dma_alloc_coherent(&pdev->dev, tx_ring->size, |
449 | &tx_ring->dma, GFP_KERNEL); | 449 | &tx_ring->dma, GFP_KERNEL); |
450 | |||
451 | if (!tx_ring->desc) | 450 | if (!tx_ring->desc) |
452 | goto err; | 451 | goto err; |
453 | 452 | ||
@@ -488,7 +487,6 @@ int igbvf_setup_rx_resources(struct igbvf_adapter *adapter, | |||
488 | 487 | ||
489 | rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size, | 488 | rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size, |
490 | &rx_ring->dma, GFP_KERNEL); | 489 | &rx_ring->dma, GFP_KERNEL); |
491 | |||
492 | if (!rx_ring->desc) | 490 | if (!rx_ring->desc) |
493 | goto err; | 491 | goto err; |
494 | 492 | ||
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c index e23f0234cb27..74464c348454 100644 --- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c +++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c | |||
@@ -717,12 +717,11 @@ ixgb_setup_tx_resources(struct ixgb_adapter *adapter) | |||
717 | txdr->size = ALIGN(txdr->size, 4096); | 717 | txdr->size = ALIGN(txdr->size, 4096); |
718 | 718 | ||
719 | txdr->desc = dma_alloc_coherent(&pdev->dev, txdr->size, &txdr->dma, | 719 | txdr->desc = dma_alloc_coherent(&pdev->dev, txdr->size, &txdr->dma, |
720 | GFP_KERNEL); | 720 | GFP_KERNEL | __GFP_ZERO); |
721 | if (!txdr->desc) { | 721 | if (!txdr->desc) { |
722 | vfree(txdr->buffer_info); | 722 | vfree(txdr->buffer_info); |
723 | return -ENOMEM; | 723 | return -ENOMEM; |
724 | } | 724 | } |
725 | memset(txdr->desc, 0, txdr->size); | ||
726 | 725 | ||
727 | txdr->next_to_use = 0; | 726 | txdr->next_to_use = 0; |
728 | txdr->next_to_clean = 0; | 727 | txdr->next_to_clean = 0; |
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c index 3ae4c7f0834d..339bb323cb0c 100644 --- a/drivers/net/ethernet/marvell/pxa168_eth.c +++ b/drivers/net/ethernet/marvell/pxa168_eth.c | |||
@@ -584,12 +584,14 @@ static int init_hash_table(struct pxa168_eth_private *pep) | |||
584 | */ | 584 | */ |
585 | if (pep->htpr == NULL) { | 585 | if (pep->htpr == NULL) { |
586 | pep->htpr = dma_alloc_coherent(pep->dev->dev.parent, | 586 | pep->htpr = dma_alloc_coherent(pep->dev->dev.parent, |
587 | HASH_ADDR_TABLE_SIZE, | 587 | HASH_ADDR_TABLE_SIZE, |
588 | &pep->htpr_dma, GFP_KERNEL); | 588 | &pep->htpr_dma, |
589 | GFP_KERNEL | __GFP_ZERO); | ||
589 | if (pep->htpr == NULL) | 590 | if (pep->htpr == NULL) |
590 | return -ENOMEM; | 591 | return -ENOMEM; |
592 | } else { | ||
593 | memset(pep->htpr, 0, HASH_ADDR_TABLE_SIZE); | ||
591 | } | 594 | } |
592 | memset(pep->htpr, 0, HASH_ADDR_TABLE_SIZE); | ||
593 | wrl(pep, HTPR, pep->htpr_dma); | 595 | wrl(pep, HTPR, pep->htpr_dma); |
594 | return 0; | 596 | return 0; |
595 | } | 597 | } |
@@ -1023,11 +1025,11 @@ static int rxq_init(struct net_device *dev) | |||
1023 | size = pep->rx_ring_size * sizeof(struct rx_desc); | 1025 | size = pep->rx_ring_size * sizeof(struct rx_desc); |
1024 | pep->rx_desc_area_size = size; | 1026 | pep->rx_desc_area_size = size; |
1025 | pep->p_rx_desc_area = dma_alloc_coherent(pep->dev->dev.parent, size, | 1027 | pep->p_rx_desc_area = dma_alloc_coherent(pep->dev->dev.parent, size, |
1026 | &pep->rx_desc_dma, GFP_KERNEL); | 1028 | &pep->rx_desc_dma, |
1029 | GFP_KERNEL | __GFP_ZERO); | ||
1027 | if (!pep->p_rx_desc_area) | 1030 | if (!pep->p_rx_desc_area) |
1028 | goto out; | 1031 | goto out; |
1029 | 1032 | ||
1030 | memset((void *)pep->p_rx_desc_area, 0, size); | ||
1031 | /* initialize the next_desc_ptr links in the Rx descriptors ring */ | 1033 | /* initialize the next_desc_ptr links in the Rx descriptors ring */ |
1032 | p_rx_desc = pep->p_rx_desc_area; | 1034 | p_rx_desc = pep->p_rx_desc_area; |
1033 | for (i = 0; i < rx_desc_num; i++) { | 1035 | for (i = 0; i < rx_desc_num; i++) { |
@@ -1084,10 +1086,10 @@ static int txq_init(struct net_device *dev) | |||
1084 | size = pep->tx_ring_size * sizeof(struct tx_desc); | 1086 | size = pep->tx_ring_size * sizeof(struct tx_desc); |
1085 | pep->tx_desc_area_size = size; | 1087 | pep->tx_desc_area_size = size; |
1086 | pep->p_tx_desc_area = dma_alloc_coherent(pep->dev->dev.parent, size, | 1088 | pep->p_tx_desc_area = dma_alloc_coherent(pep->dev->dev.parent, size, |
1087 | &pep->tx_desc_dma, GFP_KERNEL); | 1089 | &pep->tx_desc_dma, |
1090 | GFP_KERNEL | __GFP_ZERO); | ||
1088 | if (!pep->p_tx_desc_area) | 1091 | if (!pep->p_tx_desc_area) |
1089 | goto out; | 1092 | goto out; |
1090 | memset((void *)pep->p_tx_desc_area, 0, pep->tx_desc_area_size); | ||
1091 | /* Initialize the next_desc_ptr links in the Tx descriptors ring */ | 1093 | /* Initialize the next_desc_ptr links in the Tx descriptors ring */ |
1092 | p_tx_desc = pep->p_tx_desc_area; | 1094 | p_tx_desc = pep->p_tx_desc_area; |
1093 | for (i = 0; i < tx_desc_num; i++) { | 1095 | for (i = 0; i < tx_desc_num; i++) { |
diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c index 4f9937e026e5..d5ffdc8264eb 100644 --- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c +++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c | |||
@@ -3592,10 +3592,9 @@ static int myri10ge_alloc_slices(struct myri10ge_priv *mgp) | |||
3592 | bytes = mgp->max_intr_slots * sizeof(*ss->rx_done.entry); | 3592 | bytes = mgp->max_intr_slots * sizeof(*ss->rx_done.entry); |
3593 | ss->rx_done.entry = dma_alloc_coherent(&pdev->dev, bytes, | 3593 | ss->rx_done.entry = dma_alloc_coherent(&pdev->dev, bytes, |
3594 | &ss->rx_done.bus, | 3594 | &ss->rx_done.bus, |
3595 | GFP_KERNEL); | 3595 | GFP_KERNEL | __GFP_ZERO); |
3596 | if (ss->rx_done.entry == NULL) | 3596 | if (ss->rx_done.entry == NULL) |
3597 | goto abort; | 3597 | goto abort; |
3598 | memset(ss->rx_done.entry, 0, bytes); | ||
3599 | bytes = sizeof(*ss->fw_stats); | 3598 | bytes = sizeof(*ss->fw_stats); |
3600 | ss->fw_stats = dma_alloc_coherent(&pdev->dev, bytes, | 3599 | ss->fw_stats = dma_alloc_coherent(&pdev->dev, bytes, |
3601 | &ss->fw_stats_bus, | 3600 | &ss->fw_stats_bus, |
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c index 4bdca9ec6a1a..abd5fba09b85 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | |||
@@ -1470,11 +1470,10 @@ pch_gbe_alloc_rx_buffers_pool(struct pch_gbe_adapter *adapter, | |||
1470 | size = rx_ring->count * bufsz + PCH_GBE_RESERVE_MEMORY; | 1470 | size = rx_ring->count * bufsz + PCH_GBE_RESERVE_MEMORY; |
1471 | rx_ring->rx_buff_pool = dma_alloc_coherent(&pdev->dev, size, | 1471 | rx_ring->rx_buff_pool = dma_alloc_coherent(&pdev->dev, size, |
1472 | &rx_ring->rx_buff_pool_logic, | 1472 | &rx_ring->rx_buff_pool_logic, |
1473 | GFP_KERNEL); | 1473 | GFP_KERNEL | __GFP_ZERO); |
1474 | if (!rx_ring->rx_buff_pool) | 1474 | if (!rx_ring->rx_buff_pool) |
1475 | return -ENOMEM; | 1475 | return -ENOMEM; |
1476 | 1476 | ||
1477 | memset(rx_ring->rx_buff_pool, 0, size); | ||
1478 | rx_ring->rx_buff_pool_size = size; | 1477 | rx_ring->rx_buff_pool_size = size; |
1479 | for (i = 0; i < rx_ring->count; i++) { | 1478 | for (i = 0; i < rx_ring->count; i++) { |
1480 | buffer_info = &rx_ring->buffer_info[i]; | 1479 | buffer_info = &rx_ring->buffer_info[i]; |
@@ -1773,12 +1772,12 @@ int pch_gbe_setup_tx_resources(struct pch_gbe_adapter *adapter, | |||
1773 | tx_ring->size = tx_ring->count * (int)sizeof(struct pch_gbe_tx_desc); | 1772 | tx_ring->size = tx_ring->count * (int)sizeof(struct pch_gbe_tx_desc); |
1774 | 1773 | ||
1775 | tx_ring->desc = dma_alloc_coherent(&pdev->dev, tx_ring->size, | 1774 | tx_ring->desc = dma_alloc_coherent(&pdev->dev, tx_ring->size, |
1776 | &tx_ring->dma, GFP_KERNEL); | 1775 | &tx_ring->dma, |
1776 | GFP_KERNEL | __GFP_ZERO); | ||
1777 | if (!tx_ring->desc) { | 1777 | if (!tx_ring->desc) { |
1778 | vfree(tx_ring->buffer_info); | 1778 | vfree(tx_ring->buffer_info); |
1779 | return -ENOMEM; | 1779 | return -ENOMEM; |
1780 | } | 1780 | } |
1781 | memset(tx_ring->desc, 0, tx_ring->size); | ||
1782 | 1781 | ||
1783 | tx_ring->next_to_use = 0; | 1782 | tx_ring->next_to_use = 0; |
1784 | tx_ring->next_to_clean = 0; | 1783 | tx_ring->next_to_clean = 0; |
@@ -1818,12 +1817,12 @@ int pch_gbe_setup_rx_resources(struct pch_gbe_adapter *adapter, | |||
1818 | 1817 | ||
1819 | rx_ring->size = rx_ring->count * (int)sizeof(struct pch_gbe_rx_desc); | 1818 | rx_ring->size = rx_ring->count * (int)sizeof(struct pch_gbe_rx_desc); |
1820 | rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size, | 1819 | rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size, |
1821 | &rx_ring->dma, GFP_KERNEL); | 1820 | &rx_ring->dma, |
1821 | GFP_KERNEL | __GFP_ZERO); | ||
1822 | if (!rx_ring->desc) { | 1822 | if (!rx_ring->desc) { |
1823 | vfree(rx_ring->buffer_info); | 1823 | vfree(rx_ring->buffer_info); |
1824 | return -ENOMEM; | 1824 | return -ENOMEM; |
1825 | } | 1825 | } |
1826 | memset(rx_ring->desc, 0, rx_ring->size); | ||
1827 | rx_ring->next_to_clean = 0; | 1826 | rx_ring->next_to_clean = 0; |
1828 | rx_ring->next_to_use = 0; | 1827 | rx_ring->next_to_use = 0; |
1829 | for (desNo = 0; desNo < rx_ring->count; desNo++) { | 1828 | for (desNo = 0; desNo < rx_ring->count; desNo++) { |
diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c index b1cfbb75ff1e..a5f0b5da6149 100644 --- a/drivers/net/ethernet/pasemi/pasemi_mac.c +++ b/drivers/net/ethernet/pasemi/pasemi_mac.c | |||
@@ -441,12 +441,11 @@ static int pasemi_mac_setup_rx_resources(const struct net_device *dev) | |||
441 | 441 | ||
442 | ring->buffers = dma_alloc_coherent(&mac->dma_pdev->dev, | 442 | ring->buffers = dma_alloc_coherent(&mac->dma_pdev->dev, |
443 | RX_RING_SIZE * sizeof(u64), | 443 | RX_RING_SIZE * sizeof(u64), |
444 | &ring->buf_dma, GFP_KERNEL); | 444 | &ring->buf_dma, |
445 | GFP_KERNEL | __GFP_ZERO); | ||
445 | if (!ring->buffers) | 446 | if (!ring->buffers) |
446 | goto out_ring_desc; | 447 | goto out_ring_desc; |
447 | 448 | ||
448 | memset(ring->buffers, 0, RX_RING_SIZE * sizeof(u64)); | ||
449 | |||
450 | write_dma_reg(PAS_DMA_RXCHAN_BASEL(chno), | 449 | write_dma_reg(PAS_DMA_RXCHAN_BASEL(chno), |
451 | PAS_DMA_RXCHAN_BASEL_BRBL(ring->chan.ring_dma)); | 450 | PAS_DMA_RXCHAN_BASEL_BRBL(ring->chan.ring_dma)); |
452 | 451 | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c index a0649ece8e0a..2d9c23fcec51 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | |||
@@ -422,22 +422,20 @@ int qlcnic_82xx_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter, | |||
422 | 422 | ||
423 | rq_size = SIZEOF_HOSTRQ_TX(struct qlcnic_hostrq_tx_ctx); | 423 | rq_size = SIZEOF_HOSTRQ_TX(struct qlcnic_hostrq_tx_ctx); |
424 | rq_addr = dma_alloc_coherent(&adapter->pdev->dev, rq_size, | 424 | rq_addr = dma_alloc_coherent(&adapter->pdev->dev, rq_size, |
425 | &rq_phys_addr, GFP_KERNEL); | 425 | &rq_phys_addr, GFP_KERNEL | __GFP_ZERO); |
426 | if (!rq_addr) | 426 | if (!rq_addr) |
427 | return -ENOMEM; | 427 | return -ENOMEM; |
428 | 428 | ||
429 | rsp_size = SIZEOF_CARDRSP_TX(struct qlcnic_cardrsp_tx_ctx); | 429 | rsp_size = SIZEOF_CARDRSP_TX(struct qlcnic_cardrsp_tx_ctx); |
430 | rsp_addr = dma_alloc_coherent(&adapter->pdev->dev, rsp_size, | 430 | rsp_addr = dma_alloc_coherent(&adapter->pdev->dev, rsp_size, |
431 | &rsp_phys_addr, GFP_KERNEL); | 431 | &rsp_phys_addr, GFP_KERNEL | __GFP_ZERO); |
432 | if (!rsp_addr) { | 432 | if (!rsp_addr) { |
433 | err = -ENOMEM; | 433 | err = -ENOMEM; |
434 | goto out_free_rq; | 434 | goto out_free_rq; |
435 | } | 435 | } |
436 | 436 | ||
437 | memset(rq_addr, 0, rq_size); | ||
438 | prq = rq_addr; | 437 | prq = rq_addr; |
439 | 438 | ||
440 | memset(rsp_addr, 0, rsp_size); | ||
441 | prsp = rsp_addr; | 439 | prsp = rsp_addr; |
442 | 440 | ||
443 | prq->host_rsp_dma_addr = cpu_to_le64(rsp_phys_addr); | 441 | prq->host_rsp_dma_addr = cpu_to_le64(rsp_phys_addr); |
@@ -744,10 +742,9 @@ int qlcnic_82xx_get_nic_info(struct qlcnic_adapter *adapter, | |||
744 | size_t nic_size = sizeof(struct qlcnic_info_le); | 742 | size_t nic_size = sizeof(struct qlcnic_info_le); |
745 | 743 | ||
746 | nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size, | 744 | nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size, |
747 | &nic_dma_t, GFP_KERNEL); | 745 | &nic_dma_t, GFP_KERNEL | __GFP_ZERO); |
748 | if (!nic_info_addr) | 746 | if (!nic_info_addr) |
749 | return -ENOMEM; | 747 | return -ENOMEM; |
750 | memset(nic_info_addr, 0, nic_size); | ||
751 | 748 | ||
752 | nic_info = nic_info_addr; | 749 | nic_info = nic_info_addr; |
753 | 750 | ||
@@ -795,11 +792,10 @@ int qlcnic_82xx_set_nic_info(struct qlcnic_adapter *adapter, | |||
795 | return err; | 792 | return err; |
796 | 793 | ||
797 | nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size, | 794 | nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size, |
798 | &nic_dma_t, GFP_KERNEL); | 795 | &nic_dma_t, GFP_KERNEL | __GFP_ZERO); |
799 | if (!nic_info_addr) | 796 | if (!nic_info_addr) |
800 | return -ENOMEM; | 797 | return -ENOMEM; |
801 | 798 | ||
802 | memset(nic_info_addr, 0, nic_size); | ||
803 | nic_info = nic_info_addr; | 799 | nic_info = nic_info_addr; |
804 | 800 | ||
805 | nic_info->pci_func = cpu_to_le16(nic->pci_func); | 801 | nic_info->pci_func = cpu_to_le16(nic->pci_func); |
@@ -845,10 +841,10 @@ int qlcnic_82xx_get_pci_info(struct qlcnic_adapter *adapter, | |||
845 | size_t pci_size = npar_size * QLCNIC_MAX_PCI_FUNC; | 841 | size_t pci_size = npar_size * QLCNIC_MAX_PCI_FUNC; |
846 | 842 | ||
847 | pci_info_addr = dma_alloc_coherent(&adapter->pdev->dev, pci_size, | 843 | pci_info_addr = dma_alloc_coherent(&adapter->pdev->dev, pci_size, |
848 | &pci_info_dma_t, GFP_KERNEL); | 844 | &pci_info_dma_t, |
845 | GFP_KERNEL | __GFP_ZERO); | ||
849 | if (!pci_info_addr) | 846 | if (!pci_info_addr) |
850 | return -ENOMEM; | 847 | return -ENOMEM; |
851 | memset(pci_info_addr, 0, pci_size); | ||
852 | 848 | ||
853 | npar = pci_info_addr; | 849 | npar = pci_info_addr; |
854 | qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_PCI_INFO); | 850 | qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_PCI_INFO); |
@@ -940,12 +936,10 @@ int qlcnic_get_port_stats(struct qlcnic_adapter *adapter, const u8 func, | |||
940 | } | 936 | } |
941 | 937 | ||
942 | stats_addr = dma_alloc_coherent(&adapter->pdev->dev, stats_size, | 938 | stats_addr = dma_alloc_coherent(&adapter->pdev->dev, stats_size, |
943 | &stats_dma_t, GFP_KERNEL); | 939 | &stats_dma_t, GFP_KERNEL | __GFP_ZERO); |
944 | if (!stats_addr) | 940 | if (!stats_addr) |
945 | return -ENOMEM; | 941 | return -ENOMEM; |
946 | 942 | ||
947 | memset(stats_addr, 0, stats_size); | ||
948 | |||
949 | arg1 = func | QLCNIC_STATS_VERSION << 8 | QLCNIC_STATS_PORT << 12; | 943 | arg1 = func | QLCNIC_STATS_VERSION << 8 | QLCNIC_STATS_PORT << 12; |
950 | arg1 |= rx_tx << 15 | stats_size << 16; | 944 | arg1 |= rx_tx << 15 | stats_size << 16; |
951 | 945 | ||
@@ -993,11 +987,10 @@ int qlcnic_get_mac_stats(struct qlcnic_adapter *adapter, | |||
993 | return -ENOMEM; | 987 | return -ENOMEM; |
994 | 988 | ||
995 | stats_addr = dma_alloc_coherent(&adapter->pdev->dev, stats_size, | 989 | stats_addr = dma_alloc_coherent(&adapter->pdev->dev, stats_size, |
996 | &stats_dma_t, GFP_KERNEL); | 990 | &stats_dma_t, GFP_KERNEL | __GFP_ZERO); |
997 | if (!stats_addr) | 991 | if (!stats_addr) |
998 | return -ENOMEM; | 992 | return -ENOMEM; |
999 | 993 | ||
1000 | memset(stats_addr, 0, stats_size); | ||
1001 | qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_MAC_STATS); | 994 | qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_MAC_STATS); |
1002 | cmd.req.arg[1] = stats_size << 16; | 995 | cmd.req.arg[1] = stats_size << 16; |
1003 | cmd.req.arg[2] = MSD(stats_dma_t); | 996 | cmd.req.arg[2] = MSD(stats_dma_t); |
diff --git a/drivers/net/ethernet/sfc/nic.c b/drivers/net/ethernet/sfc/nic.c index f9f5df8b51fe..7b87798409cc 100644 --- a/drivers/net/ethernet/sfc/nic.c +++ b/drivers/net/ethernet/sfc/nic.c | |||
@@ -305,11 +305,11 @@ int efx_nic_alloc_buffer(struct efx_nic *efx, struct efx_buffer *buffer, | |||
305 | unsigned int len) | 305 | unsigned int len) |
306 | { | 306 | { |
307 | buffer->addr = dma_alloc_coherent(&efx->pci_dev->dev, len, | 307 | buffer->addr = dma_alloc_coherent(&efx->pci_dev->dev, len, |
308 | &buffer->dma_addr, GFP_ATOMIC); | 308 | &buffer->dma_addr, |
309 | GFP_ATOMIC | __GFP_ZERO); | ||
309 | if (!buffer->addr) | 310 | if (!buffer->addr) |
310 | return -ENOMEM; | 311 | return -ENOMEM; |
311 | buffer->len = len; | 312 | buffer->len = len; |
312 | memset(buffer->addr, 0, len); | ||
313 | return 0; | 313 | return 0; |
314 | } | 314 | } |
315 | 315 | ||
diff --git a/drivers/net/ethernet/sgi/meth.c b/drivers/net/ethernet/sgi/meth.c index 79ad9c94a21b..4bdbaad9932d 100644 --- a/drivers/net/ethernet/sgi/meth.c +++ b/drivers/net/ethernet/sgi/meth.c | |||
@@ -213,10 +213,11 @@ static int meth_init_tx_ring(struct meth_private *priv) | |||
213 | { | 213 | { |
214 | /* Init TX ring */ | 214 | /* Init TX ring */ |
215 | priv->tx_ring = dma_alloc_coherent(NULL, TX_RING_BUFFER_SIZE, | 215 | priv->tx_ring = dma_alloc_coherent(NULL, TX_RING_BUFFER_SIZE, |
216 | &priv->tx_ring_dma, GFP_ATOMIC); | 216 | &priv->tx_ring_dma, |
217 | GFP_ATOMIC | __GFP_ZERO); | ||
217 | if (!priv->tx_ring) | 218 | if (!priv->tx_ring) |
218 | return -ENOMEM; | 219 | return -ENOMEM; |
219 | memset(priv->tx_ring, 0, TX_RING_BUFFER_SIZE); | 220 | |
220 | priv->tx_count = priv->tx_read = priv->tx_write = 0; | 221 | priv->tx_count = priv->tx_read = priv->tx_write = 0; |
221 | mace->eth.tx_ring_base = priv->tx_ring_dma; | 222 | mace->eth.tx_ring_base = priv->tx_ring_dma; |
222 | /* Now init skb save area */ | 223 | /* Now init skb save area */ |
diff --git a/drivers/net/ethernet/toshiba/spider_net.c b/drivers/net/ethernet/toshiba/spider_net.c index f1b91fd7e41c..fef6b59e69c9 100644 --- a/drivers/net/ethernet/toshiba/spider_net.c +++ b/drivers/net/ethernet/toshiba/spider_net.c | |||
@@ -352,8 +352,7 @@ spider_net_init_chain(struct spider_net_card *card, | |||
352 | alloc_size = chain->num_desc * sizeof(struct spider_net_hw_descr); | 352 | alloc_size = chain->num_desc * sizeof(struct spider_net_hw_descr); |
353 | 353 | ||
354 | chain->hwring = dma_alloc_coherent(&card->pdev->dev, alloc_size, | 354 | chain->hwring = dma_alloc_coherent(&card->pdev->dev, alloc_size, |
355 | &chain->dma_addr, GFP_KERNEL); | 355 | &chain->dma_addr, GFP_KERNEL); |
356 | |||
357 | if (!chain->hwring) | 356 | if (!chain->hwring) |
358 | return -ENOMEM; | 357 | return -ENOMEM; |
359 | 358 | ||
diff --git a/drivers/net/ethernet/tundra/tsi108_eth.c b/drivers/net/ethernet/tundra/tsi108_eth.c index 99fe3c6eea31..3c69a0460832 100644 --- a/drivers/net/ethernet/tundra/tsi108_eth.c +++ b/drivers/net/ethernet/tundra/tsi108_eth.c | |||
@@ -1308,21 +1308,16 @@ static int tsi108_open(struct net_device *dev) | |||
1308 | data->id, dev->irq, dev->name); | 1308 | data->id, dev->irq, dev->name); |
1309 | } | 1309 | } |
1310 | 1310 | ||
1311 | data->rxring = dma_alloc_coherent(NULL, rxring_size, | 1311 | data->rxring = dma_alloc_coherent(NULL, rxring_size, &data->rxdma, |
1312 | &data->rxdma, GFP_KERNEL); | 1312 | GFP_KERNEL | __GFP_ZERO); |
1313 | if (!data->rxring) { | 1313 | if (!data->rxring) |
1314 | return -ENOMEM; | 1314 | return -ENOMEM; |
1315 | } else { | ||
1316 | memset(data->rxring, 0, rxring_size); | ||
1317 | } | ||
1318 | 1315 | ||
1319 | data->txring = dma_alloc_coherent(NULL, txring_size, | 1316 | data->txring = dma_alloc_coherent(NULL, txring_size, &data->txdma, |
1320 | &data->txdma, GFP_KERNEL); | 1317 | GFP_KERNEL | __GFP_ZERO); |
1321 | if (!data->txring) { | 1318 | if (!data->txring) { |
1322 | pci_free_consistent(0, rxring_size, data->rxring, data->rxdma); | 1319 | pci_free_consistent(0, rxring_size, data->rxring, data->rxdma); |
1323 | return -ENOMEM; | 1320 | return -ENOMEM; |
1324 | } else { | ||
1325 | memset(data->txring, 0, txring_size); | ||
1326 | } | 1321 | } |
1327 | 1322 | ||
1328 | for (i = 0; i < TSI108_RXRING_LEN; i++) { | 1323 | for (i = 0; i < TSI108_RXRING_LEN; i++) { |
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c index a64a6d74a5c8..4a7c60f4c83d 100644 --- a/drivers/net/ethernet/xilinx/ll_temac_main.c +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c | |||
@@ -245,23 +245,21 @@ static int temac_dma_bd_init(struct net_device *ndev) | |||
245 | /* returns a virtual address and a physical address. */ | 245 | /* returns a virtual address and a physical address. */ |
246 | lp->tx_bd_v = dma_alloc_coherent(ndev->dev.parent, | 246 | lp->tx_bd_v = dma_alloc_coherent(ndev->dev.parent, |
247 | sizeof(*lp->tx_bd_v) * TX_BD_NUM, | 247 | sizeof(*lp->tx_bd_v) * TX_BD_NUM, |
248 | &lp->tx_bd_p, GFP_KERNEL); | 248 | &lp->tx_bd_p, GFP_KERNEL | __GFP_ZERO); |
249 | if (!lp->tx_bd_v) | 249 | if (!lp->tx_bd_v) |
250 | goto out; | 250 | goto out; |
251 | 251 | ||
252 | lp->rx_bd_v = dma_alloc_coherent(ndev->dev.parent, | 252 | lp->rx_bd_v = dma_alloc_coherent(ndev->dev.parent, |
253 | sizeof(*lp->rx_bd_v) * RX_BD_NUM, | 253 | sizeof(*lp->rx_bd_v) * RX_BD_NUM, |
254 | &lp->rx_bd_p, GFP_KERNEL); | 254 | &lp->rx_bd_p, GFP_KERNEL | __GFP_ZERO); |
255 | if (!lp->rx_bd_v) | 255 | if (!lp->rx_bd_v) |
256 | goto out; | 256 | goto out; |
257 | 257 | ||
258 | memset(lp->tx_bd_v, 0, sizeof(*lp->tx_bd_v) * TX_BD_NUM); | ||
259 | for (i = 0; i < TX_BD_NUM; i++) { | 258 | for (i = 0; i < TX_BD_NUM; i++) { |
260 | lp->tx_bd_v[i].next = lp->tx_bd_p + | 259 | lp->tx_bd_v[i].next = lp->tx_bd_p + |
261 | sizeof(*lp->tx_bd_v) * ((i + 1) % TX_BD_NUM); | 260 | sizeof(*lp->tx_bd_v) * ((i + 1) % TX_BD_NUM); |
262 | } | 261 | } |
263 | 262 | ||
264 | memset(lp->rx_bd_v, 0, sizeof(*lp->rx_bd_v) * RX_BD_NUM); | ||
265 | for (i = 0; i < RX_BD_NUM; i++) { | 263 | for (i = 0; i < RX_BD_NUM; i++) { |
266 | lp->rx_bd_v[i].next = lp->rx_bd_p + | 264 | lp->rx_bd_v[i].next = lp->rx_bd_p + |
267 | sizeof(*lp->rx_bd_v) * ((i + 1) % RX_BD_NUM); | 265 | sizeof(*lp->rx_bd_v) * ((i + 1) % RX_BD_NUM); |
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index c238f980e28e..24748e8367a1 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c | |||
@@ -204,25 +204,23 @@ static int axienet_dma_bd_init(struct net_device *ndev) | |||
204 | lp->tx_bd_v = dma_alloc_coherent(ndev->dev.parent, | 204 | lp->tx_bd_v = dma_alloc_coherent(ndev->dev.parent, |
205 | sizeof(*lp->tx_bd_v) * TX_BD_NUM, | 205 | sizeof(*lp->tx_bd_v) * TX_BD_NUM, |
206 | &lp->tx_bd_p, | 206 | &lp->tx_bd_p, |
207 | GFP_KERNEL); | 207 | GFP_KERNEL | __GFP_ZERO); |
208 | if (!lp->tx_bd_v) | 208 | if (!lp->tx_bd_v) |
209 | goto out; | 209 | goto out; |
210 | 210 | ||
211 | lp->rx_bd_v = dma_alloc_coherent(ndev->dev.parent, | 211 | lp->rx_bd_v = dma_alloc_coherent(ndev->dev.parent, |
212 | sizeof(*lp->rx_bd_v) * RX_BD_NUM, | 212 | sizeof(*lp->rx_bd_v) * RX_BD_NUM, |
213 | &lp->rx_bd_p, | 213 | &lp->rx_bd_p, |
214 | GFP_KERNEL); | 214 | GFP_KERNEL | __GFP_ZERO); |
215 | if (!lp->rx_bd_v) | 215 | if (!lp->rx_bd_v) |
216 | goto out; | 216 | goto out; |
217 | 217 | ||
218 | memset(lp->tx_bd_v, 0, sizeof(*lp->tx_bd_v) * TX_BD_NUM); | ||
219 | for (i = 0; i < TX_BD_NUM; i++) { | 218 | for (i = 0; i < TX_BD_NUM; i++) { |
220 | lp->tx_bd_v[i].next = lp->tx_bd_p + | 219 | lp->tx_bd_v[i].next = lp->tx_bd_p + |
221 | sizeof(*lp->tx_bd_v) * | 220 | sizeof(*lp->tx_bd_v) * |
222 | ((i + 1) % TX_BD_NUM); | 221 | ((i + 1) % TX_BD_NUM); |
223 | } | 222 | } |
224 | 223 | ||
225 | memset(lp->rx_bd_v, 0, sizeof(*lp->rx_bd_v) * RX_BD_NUM); | ||
226 | for (i = 0; i < RX_BD_NUM; i++) { | 224 | for (i = 0; i < RX_BD_NUM; i++) { |
227 | lp->rx_bd_v[i].next = lp->rx_bd_p + | 225 | lp->rx_bd_v[i].next = lp->rx_bd_p + |
228 | sizeof(*lp->rx_bd_v) * | 226 | sizeof(*lp->rx_bd_v) * |
diff --git a/drivers/net/fddi/defxx.c b/drivers/net/fddi/defxx.c index f116e51e3865..4c8ddc944d51 100644 --- a/drivers/net/fddi/defxx.c +++ b/drivers/net/fddi/defxx.c | |||
@@ -1070,11 +1070,10 @@ static int dfx_driver_init(struct net_device *dev, const char *print_name, | |||
1070 | (PI_ALIGN_K_DESC_BLK - 1); | 1070 | (PI_ALIGN_K_DESC_BLK - 1); |
1071 | bp->kmalloced = top_v = dma_alloc_coherent(bp->bus_dev, alloc_size, | 1071 | bp->kmalloced = top_v = dma_alloc_coherent(bp->bus_dev, alloc_size, |
1072 | &bp->kmalloced_dma, | 1072 | &bp->kmalloced_dma, |
1073 | GFP_ATOMIC); | 1073 | GFP_ATOMIC | __GFP_ZERO); |
1074 | if (top_v == NULL) | 1074 | if (top_v == NULL) |
1075 | return DFX_K_FAILURE; | 1075 | return DFX_K_FAILURE; |
1076 | 1076 | ||
1077 | memset(top_v, 0, alloc_size); /* zero out memory before continuing */ | ||
1078 | top_p = bp->kmalloced_dma; /* get physical address of buffer */ | 1077 | top_p = bp->kmalloced_dma; /* get physical address of buffer */ |
1079 | 1078 | ||
1080 | /* | 1079 | /* |
diff --git a/drivers/net/irda/ali-ircc.c b/drivers/net/irda/ali-ircc.c index 9cea451a6081..3adb43ce138f 100644 --- a/drivers/net/irda/ali-ircc.c +++ b/drivers/net/irda/ali-ircc.c | |||
@@ -352,21 +352,19 @@ static int ali_ircc_open(int i, chipio_t *info) | |||
352 | /* Allocate memory if needed */ | 352 | /* Allocate memory if needed */ |
353 | self->rx_buff.head = | 353 | self->rx_buff.head = |
354 | dma_alloc_coherent(NULL, self->rx_buff.truesize, | 354 | dma_alloc_coherent(NULL, self->rx_buff.truesize, |
355 | &self->rx_buff_dma, GFP_KERNEL); | 355 | &self->rx_buff_dma, GFP_KERNEL | __GFP_ZERO); |
356 | if (self->rx_buff.head == NULL) { | 356 | if (self->rx_buff.head == NULL) { |
357 | err = -ENOMEM; | 357 | err = -ENOMEM; |
358 | goto err_out2; | 358 | goto err_out2; |
359 | } | 359 | } |
360 | memset(self->rx_buff.head, 0, self->rx_buff.truesize); | ||
361 | 360 | ||
362 | self->tx_buff.head = | 361 | self->tx_buff.head = |
363 | dma_alloc_coherent(NULL, self->tx_buff.truesize, | 362 | dma_alloc_coherent(NULL, self->tx_buff.truesize, |
364 | &self->tx_buff_dma, GFP_KERNEL); | 363 | &self->tx_buff_dma, GFP_KERNEL | __GFP_ZERO); |
365 | if (self->tx_buff.head == NULL) { | 364 | if (self->tx_buff.head == NULL) { |
366 | err = -ENOMEM; | 365 | err = -ENOMEM; |
367 | goto err_out3; | 366 | goto err_out3; |
368 | } | 367 | } |
369 | memset(self->tx_buff.head, 0, self->tx_buff.truesize); | ||
370 | 368 | ||
371 | self->rx_buff.in_frame = FALSE; | 369 | self->rx_buff.in_frame = FALSE; |
372 | self->rx_buff.state = OUTSIDE_FRAME; | 370 | self->rx_buff.state = OUTSIDE_FRAME; |
diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c index 2a4f2f153244..9cf836b57c49 100644 --- a/drivers/net/irda/nsc-ircc.c +++ b/drivers/net/irda/nsc-ircc.c | |||
@@ -431,22 +431,20 @@ static int __init nsc_ircc_open(chipio_t *info) | |||
431 | /* Allocate memory if needed */ | 431 | /* Allocate memory if needed */ |
432 | self->rx_buff.head = | 432 | self->rx_buff.head = |
433 | dma_alloc_coherent(NULL, self->rx_buff.truesize, | 433 | dma_alloc_coherent(NULL, self->rx_buff.truesize, |
434 | &self->rx_buff_dma, GFP_KERNEL); | 434 | &self->rx_buff_dma, GFP_KERNEL | __GFP_ZERO); |
435 | if (self->rx_buff.head == NULL) { | 435 | if (self->rx_buff.head == NULL) { |
436 | err = -ENOMEM; | 436 | err = -ENOMEM; |
437 | goto out2; | 437 | goto out2; |
438 | 438 | ||
439 | } | 439 | } |
440 | memset(self->rx_buff.head, 0, self->rx_buff.truesize); | ||
441 | 440 | ||
442 | self->tx_buff.head = | 441 | self->tx_buff.head = |
443 | dma_alloc_coherent(NULL, self->tx_buff.truesize, | 442 | dma_alloc_coherent(NULL, self->tx_buff.truesize, |
444 | &self->tx_buff_dma, GFP_KERNEL); | 443 | &self->tx_buff_dma, GFP_KERNEL | __GFP_ZERO); |
445 | if (self->tx_buff.head == NULL) { | 444 | if (self->tx_buff.head == NULL) { |
446 | err = -ENOMEM; | 445 | err = -ENOMEM; |
447 | goto out3; | 446 | goto out3; |
448 | } | 447 | } |
449 | memset(self->tx_buff.head, 0, self->tx_buff.truesize); | ||
450 | 448 | ||
451 | self->rx_buff.in_frame = FALSE; | 449 | self->rx_buff.in_frame = FALSE; |
452 | self->rx_buff.state = OUTSIDE_FRAME; | 450 | self->rx_buff.state = OUTSIDE_FRAME; |
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c index 858de05bdb7d..964b116a0ab7 100644 --- a/drivers/net/irda/pxaficp_ir.c +++ b/drivers/net/irda/pxaficp_ir.c | |||
@@ -700,12 +700,12 @@ static int pxa_irda_start(struct net_device *dev) | |||
700 | 700 | ||
701 | err = -ENOMEM; | 701 | err = -ENOMEM; |
702 | si->dma_rx_buff = dma_alloc_coherent(si->dev, IRDA_FRAME_SIZE_LIMIT, | 702 | si->dma_rx_buff = dma_alloc_coherent(si->dev, IRDA_FRAME_SIZE_LIMIT, |
703 | &si->dma_rx_buff_phy, GFP_KERNEL ); | 703 | &si->dma_rx_buff_phy, GFP_KERNEL); |
704 | if (!si->dma_rx_buff) | 704 | if (!si->dma_rx_buff) |
705 | goto err_dma_rx_buff; | 705 | goto err_dma_rx_buff; |
706 | 706 | ||
707 | si->dma_tx_buff = dma_alloc_coherent(si->dev, IRDA_FRAME_SIZE_LIMIT, | 707 | si->dma_tx_buff = dma_alloc_coherent(si->dev, IRDA_FRAME_SIZE_LIMIT, |
708 | &si->dma_tx_buff_phy, GFP_KERNEL ); | 708 | &si->dma_tx_buff_phy, GFP_KERNEL); |
709 | if (!si->dma_tx_buff) | 709 | if (!si->dma_tx_buff) |
710 | goto err_dma_tx_buff; | 710 | goto err_dma_tx_buff; |
711 | 711 | ||
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c index 59b45c10adbc..aa05dad75335 100644 --- a/drivers/net/irda/smsc-ircc2.c +++ b/drivers/net/irda/smsc-ircc2.c | |||
@@ -563,19 +563,16 @@ static int smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u8 dma, | |||
563 | 563 | ||
564 | self->rx_buff.head = | 564 | self->rx_buff.head = |
565 | dma_alloc_coherent(NULL, self->rx_buff.truesize, | 565 | dma_alloc_coherent(NULL, self->rx_buff.truesize, |
566 | &self->rx_buff_dma, GFP_KERNEL); | 566 | &self->rx_buff_dma, GFP_KERNEL | __GFP_ZERO); |
567 | if (self->rx_buff.head == NULL) | 567 | if (self->rx_buff.head == NULL) |
568 | goto err_out2; | 568 | goto err_out2; |
569 | 569 | ||
570 | self->tx_buff.head = | 570 | self->tx_buff.head = |
571 | dma_alloc_coherent(NULL, self->tx_buff.truesize, | 571 | dma_alloc_coherent(NULL, self->tx_buff.truesize, |
572 | &self->tx_buff_dma, GFP_KERNEL); | 572 | &self->tx_buff_dma, GFP_KERNEL | __GFP_ZERO); |
573 | if (self->tx_buff.head == NULL) | 573 | if (self->tx_buff.head == NULL) |
574 | goto err_out3; | 574 | goto err_out3; |
575 | 575 | ||
576 | memset(self->rx_buff.head, 0, self->rx_buff.truesize); | ||
577 | memset(self->tx_buff.head, 0, self->tx_buff.truesize); | ||
578 | |||
579 | self->rx_buff.in_frame = FALSE; | 576 | self->rx_buff.in_frame = FALSE; |
580 | self->rx_buff.state = OUTSIDE_FRAME; | 577 | self->rx_buff.state = OUTSIDE_FRAME; |
581 | self->tx_buff.data = self->tx_buff.head; | 578 | self->tx_buff.data = self->tx_buff.head; |
diff --git a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c index f9033c6a888c..51f2bc376101 100644 --- a/drivers/net/irda/via-ircc.c +++ b/drivers/net/irda/via-ircc.c | |||
@@ -364,21 +364,19 @@ static int via_ircc_open(struct pci_dev *pdev, chipio_t *info, unsigned int id) | |||
364 | /* Allocate memory if needed */ | 364 | /* Allocate memory if needed */ |
365 | self->rx_buff.head = | 365 | self->rx_buff.head = |
366 | dma_alloc_coherent(&pdev->dev, self->rx_buff.truesize, | 366 | dma_alloc_coherent(&pdev->dev, self->rx_buff.truesize, |
367 | &self->rx_buff_dma, GFP_KERNEL); | 367 | &self->rx_buff_dma, GFP_KERNEL | __GFP_ZERO); |
368 | if (self->rx_buff.head == NULL) { | 368 | if (self->rx_buff.head == NULL) { |
369 | err = -ENOMEM; | 369 | err = -ENOMEM; |
370 | goto err_out2; | 370 | goto err_out2; |
371 | } | 371 | } |
372 | memset(self->rx_buff.head, 0, self->rx_buff.truesize); | ||
373 | 372 | ||
374 | self->tx_buff.head = | 373 | self->tx_buff.head = |
375 | dma_alloc_coherent(&pdev->dev, self->tx_buff.truesize, | 374 | dma_alloc_coherent(&pdev->dev, self->tx_buff.truesize, |
376 | &self->tx_buff_dma, GFP_KERNEL); | 375 | &self->tx_buff_dma, GFP_KERNEL | __GFP_ZERO); |
377 | if (self->tx_buff.head == NULL) { | 376 | if (self->tx_buff.head == NULL) { |
378 | err = -ENOMEM; | 377 | err = -ENOMEM; |
379 | goto err_out3; | 378 | goto err_out3; |
380 | } | 379 | } |
381 | memset(self->tx_buff.head, 0, self->tx_buff.truesize); | ||
382 | 380 | ||
383 | self->rx_buff.in_frame = FALSE; | 381 | self->rx_buff.in_frame = FALSE; |
384 | self->rx_buff.state = OUTSIDE_FRAME; | 382 | self->rx_buff.state = OUTSIDE_FRAME; |
diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c index f5bb92f15880..bb8857a158a6 100644 --- a/drivers/net/irda/w83977af_ir.c +++ b/drivers/net/irda/w83977af_ir.c | |||
@@ -216,22 +216,19 @@ static int w83977af_open(int i, unsigned int iobase, unsigned int irq, | |||
216 | /* Allocate memory if needed */ | 216 | /* Allocate memory if needed */ |
217 | self->rx_buff.head = | 217 | self->rx_buff.head = |
218 | dma_alloc_coherent(NULL, self->rx_buff.truesize, | 218 | dma_alloc_coherent(NULL, self->rx_buff.truesize, |
219 | &self->rx_buff_dma, GFP_KERNEL); | 219 | &self->rx_buff_dma, GFP_KERNEL | __GFP_ZERO); |
220 | if (self->rx_buff.head == NULL) { | 220 | if (self->rx_buff.head == NULL) { |
221 | err = -ENOMEM; | 221 | err = -ENOMEM; |
222 | goto err_out1; | 222 | goto err_out1; |
223 | } | 223 | } |
224 | 224 | ||
225 | memset(self->rx_buff.head, 0, self->rx_buff.truesize); | ||
226 | |||
227 | self->tx_buff.head = | 225 | self->tx_buff.head = |
228 | dma_alloc_coherent(NULL, self->tx_buff.truesize, | 226 | dma_alloc_coherent(NULL, self->tx_buff.truesize, |
229 | &self->tx_buff_dma, GFP_KERNEL); | 227 | &self->tx_buff_dma, GFP_KERNEL | __GFP_ZERO); |
230 | if (self->tx_buff.head == NULL) { | 228 | if (self->tx_buff.head == NULL) { |
231 | err = -ENOMEM; | 229 | err = -ENOMEM; |
232 | goto err_out2; | 230 | goto err_out2; |
233 | } | 231 | } |
234 | memset(self->tx_buff.head, 0, self->tx_buff.truesize); | ||
235 | 232 | ||
236 | self->rx_buff.in_frame = FALSE; | 233 | self->rx_buff.in_frame = FALSE; |
237 | self->rx_buff.state = OUTSIDE_FRAME; | 234 | self->rx_buff.state = OUTSIDE_FRAME; |
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index 38bc5a7997ff..f73cbb512f7c 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c | |||
@@ -419,8 +419,6 @@ static inline | |||
419 | 419 | ||
420 | static int alloc_ringmemory(struct b43_dmaring *ring) | 420 | static int alloc_ringmemory(struct b43_dmaring *ring) |
421 | { | 421 | { |
422 | gfp_t flags = GFP_KERNEL; | ||
423 | |||
424 | /* The specs call for 4K buffers for 30- and 32-bit DMA with 4K | 422 | /* The specs call for 4K buffers for 30- and 32-bit DMA with 4K |
425 | * alignment and 8K buffers for 64-bit DMA with 8K alignment. | 423 | * alignment and 8K buffers for 64-bit DMA with 8K alignment. |
426 | * In practice we could use smaller buffers for the latter, but the | 424 | * In practice we could use smaller buffers for the latter, but the |
@@ -435,12 +433,9 @@ static int alloc_ringmemory(struct b43_dmaring *ring) | |||
435 | 433 | ||
436 | ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev, | 434 | ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev, |
437 | ring_mem_size, &(ring->dmabase), | 435 | ring_mem_size, &(ring->dmabase), |
438 | flags); | 436 | GFP_KERNEL | __GFP_ZERO); |
439 | if (!ring->descbase) { | 437 | if (!ring->descbase) |
440 | b43err(ring->dev->wl, "DMA ringmemory allocation failed\n"); | ||
441 | return -ENOMEM; | 438 | return -ENOMEM; |
442 | } | ||
443 | memset(ring->descbase, 0, ring_mem_size); | ||
444 | 439 | ||
445 | return 0; | 440 | return 0; |
446 | } | 441 | } |
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c index 07d7e928eac7..faeafe219c57 100644 --- a/drivers/net/wireless/b43legacy/dma.c +++ b/drivers/net/wireless/b43legacy/dma.c | |||
@@ -334,10 +334,9 @@ static int alloc_ringmemory(struct b43legacy_dmaring *ring) | |||
334 | ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev, | 334 | ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev, |
335 | B43legacy_DMA_RINGMEMSIZE, | 335 | B43legacy_DMA_RINGMEMSIZE, |
336 | &(ring->dmabase), | 336 | &(ring->dmabase), |
337 | GFP_KERNEL); | 337 | GFP_KERNEL | __GFP_ZERO); |
338 | if (!ring->descbase) | 338 | if (!ring->descbase) |
339 | return -ENOMEM; | 339 | return -ENOMEM; |
340 | memset(ring->descbase, 0, B43legacy_DMA_RINGMEMSIZE); | ||
341 | 340 | ||
342 | return 0; | 341 | return 0; |
343 | } | 342 | } |
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c index 7941eb3a0166..238f52874f16 100644 --- a/drivers/net/wireless/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/iwlegacy/4965-mac.c | |||
@@ -1921,8 +1921,8 @@ drop_unlock: | |||
1921 | static inline int | 1921 | static inline int |
1922 | il4965_alloc_dma_ptr(struct il_priv *il, struct il_dma_ptr *ptr, size_t size) | 1922 | il4965_alloc_dma_ptr(struct il_priv *il, struct il_dma_ptr *ptr, size_t size) |
1923 | { | 1923 | { |
1924 | ptr->addr = | 1924 | ptr->addr = dma_alloc_coherent(&il->pci_dev->dev, size, &ptr->dma, |
1925 | dma_alloc_coherent(&il->pci_dev->dev, size, &ptr->dma, GFP_KERNEL); | 1925 | GFP_KERNEL); |
1926 | if (!ptr->addr) | 1926 | if (!ptr->addr) |
1927 | return -ENOMEM; | 1927 | return -ENOMEM; |
1928 | ptr->size = size; | 1928 | ptr->size = size; |
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c index bd4c18804709..db2187124032 100644 --- a/drivers/net/wireless/iwlegacy/common.c +++ b/drivers/net/wireless/iwlegacy/common.c | |||
@@ -2566,15 +2566,13 @@ il_rx_queue_alloc(struct il_priv *il) | |||
2566 | INIT_LIST_HEAD(&rxq->rx_used); | 2566 | INIT_LIST_HEAD(&rxq->rx_used); |
2567 | 2567 | ||
2568 | /* Alloc the circular buffer of Read Buffer Descriptors (RBDs) */ | 2568 | /* Alloc the circular buffer of Read Buffer Descriptors (RBDs) */ |
2569 | rxq->bd = | 2569 | rxq->bd = dma_alloc_coherent(dev, 4 * RX_QUEUE_SIZE, &rxq->bd_dma, |
2570 | dma_alloc_coherent(dev, 4 * RX_QUEUE_SIZE, &rxq->bd_dma, | 2570 | GFP_KERNEL); |
2571 | GFP_KERNEL); | ||
2572 | if (!rxq->bd) | 2571 | if (!rxq->bd) |
2573 | goto err_bd; | 2572 | goto err_bd; |
2574 | 2573 | ||
2575 | rxq->rb_stts = | 2574 | rxq->rb_stts = dma_alloc_coherent(dev, sizeof(struct il_rb_status), |
2576 | dma_alloc_coherent(dev, sizeof(struct il_rb_status), | 2575 | &rxq->rb_stts_dma, GFP_KERNEL); |
2577 | &rxq->rb_stts_dma, GFP_KERNEL); | ||
2578 | if (!rxq->rb_stts) | 2576 | if (!rxq->rb_stts) |
2579 | goto err_rb; | 2577 | goto err_rb; |
2580 | 2578 | ||
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h index 96f2025d936e..458e699c63cd 100644 --- a/drivers/net/wireless/iwlegacy/common.h +++ b/drivers/net/wireless/iwlegacy/common.h | |||
@@ -2235,9 +2235,8 @@ il_alloc_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc) | |||
2235 | return -EINVAL; | 2235 | return -EINVAL; |
2236 | } | 2236 | } |
2237 | 2237 | ||
2238 | desc->v_addr = | 2238 | desc->v_addr = dma_alloc_coherent(&pci_dev->dev, desc->len, |
2239 | dma_alloc_coherent(&pci_dev->dev, desc->len, &desc->p_addr, | 2239 | &desc->p_addr, GFP_KERNEL); |
2240 | GFP_KERNEL); | ||
2241 | return (desc->v_addr != NULL) ? 0 : -ENOMEM; | 2240 | return (desc->v_addr != NULL) ? 0 : -ENOMEM; |
2242 | } | 2241 | } |
2243 | 2242 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index a0c8caef3b0a..696abed3e74b 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c | |||
@@ -124,12 +124,10 @@ static int rt2x00pci_alloc_queue_dma(struct rt2x00_dev *rt2x00dev, | |||
124 | */ | 124 | */ |
125 | addr = dma_alloc_coherent(rt2x00dev->dev, | 125 | addr = dma_alloc_coherent(rt2x00dev->dev, |
126 | queue->limit * queue->desc_size, | 126 | queue->limit * queue->desc_size, |
127 | &dma, GFP_KERNEL); | 127 | &dma, GFP_KERNEL | __GFP_ZERO); |
128 | if (!addr) | 128 | if (!addr) |
129 | return -ENOMEM; | 129 | return -ENOMEM; |
130 | 130 | ||
131 | memset(addr, 0, queue->limit * queue->desc_size); | ||
132 | |||
133 | /* | 131 | /* |
134 | * Initialize all queue entries to contain valid addresses. | 132 | * Initialize all queue entries to contain valid addresses. |
135 | */ | 133 | */ |