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

drivers:net: Convert dma_alloc_coherent(...__GFP_ZERO) to dma_zalloc_coherent

__GFP_ZERO is an uncommon flag and perhaps is better
not used. static inline dma_zalloc_coherent exists
so convert the uses of dma_alloc_coherent with __GFP_ZERO
to the more common kernel style with zalloc.

Remove memset from the static inline dma_zalloc_coherent
and add just one use of __GFP_ZERO instead.

Trivially reduces the size of the existing uses of
dma_zalloc_coherent.

Realign arguments as appropriate.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Joe Perches and committed by
David S. Miller
ede23fa8 afe4fd06

+135 -153
+6 -6
drivers/net/ethernet/aeroflex/greth.c
··· 1464 1464 } 1465 1465 1466 1466 /* Allocate TX descriptor ring in coherent memory */ 1467 - greth->tx_bd_base = dma_alloc_coherent(greth->dev, 1024, 1468 - &greth->tx_bd_base_phys, 1469 - GFP_KERNEL | __GFP_ZERO); 1467 + greth->tx_bd_base = dma_zalloc_coherent(greth->dev, 1024, 1468 + &greth->tx_bd_base_phys, 1469 + GFP_KERNEL); 1470 1470 if (!greth->tx_bd_base) { 1471 1471 err = -ENOMEM; 1472 1472 goto error3; 1473 1473 } 1474 1474 1475 1475 /* Allocate RX descriptor ring in coherent memory */ 1476 - greth->rx_bd_base = dma_alloc_coherent(greth->dev, 1024, 1477 - &greth->rx_bd_base_phys, 1478 - GFP_KERNEL | __GFP_ZERO); 1476 + greth->rx_bd_base = dma_zalloc_coherent(greth->dev, 1024, 1477 + &greth->rx_bd_base_phys, 1478 + GFP_KERNEL); 1479 1479 if (!greth->rx_bd_base) { 1480 1480 err = -ENOMEM; 1481 1481 goto error4;
+2 -4
drivers/net/ethernet/broadcom/bcm63xx_enet.c
··· 948 948 949 949 /* allocate rx dma ring */ 950 950 size = priv->rx_ring_size * sizeof(struct bcm_enet_desc); 951 - p = dma_alloc_coherent(kdev, size, &priv->rx_desc_dma, 952 - GFP_KERNEL | __GFP_ZERO); 951 + p = dma_zalloc_coherent(kdev, size, &priv->rx_desc_dma, GFP_KERNEL); 953 952 if (!p) { 954 953 ret = -ENOMEM; 955 954 goto out_freeirq_tx; ··· 959 960 960 961 /* allocate tx dma ring */ 961 962 size = priv->tx_ring_size * sizeof(struct bcm_enet_desc); 962 - p = dma_alloc_coherent(kdev, size, &priv->tx_desc_dma, 963 - GFP_KERNEL | __GFP_ZERO); 963 + p = dma_zalloc_coherent(kdev, size, &priv->tx_desc_dma, GFP_KERNEL); 964 964 if (!p) { 965 965 ret = -ENOMEM; 966 966 goto out_free_rx_ring;
+2 -3
drivers/net/ethernet/broadcom/bnx2.c
··· 853 853 bp->status_stats_size = status_blk_size + 854 854 sizeof(struct statistics_block); 855 855 856 - status_blk = dma_alloc_coherent(&bp->pdev->dev, bp->status_stats_size, 857 - &bp->status_blk_mapping, 858 - GFP_KERNEL | __GFP_ZERO); 856 + status_blk = dma_zalloc_coherent(&bp->pdev->dev, bp->status_stats_size, 857 + &bp->status_blk_mapping, GFP_KERNEL); 859 858 if (status_blk == NULL) 860 859 goto alloc_mem_err; 861 860
+2 -3
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
··· 2069 2069 void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id, 2070 2070 bool is_pf); 2071 2071 2072 - #define BNX2X_ILT_ZALLOC(x, y, size) \ 2073 - x = dma_alloc_coherent(&bp->pdev->dev, size, y, \ 2074 - GFP_KERNEL | __GFP_ZERO) 2072 + #define BNX2X_ILT_ZALLOC(x, y, size) \ 2073 + x = dma_zalloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL) 2075 2074 2076 2075 #define BNX2X_ILT_FREE(x, y, size) \ 2077 2076 do { \
+1 -2
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
··· 51 51 52 52 #define BNX2X_PCI_ALLOC(x, y, size) \ 53 53 do { \ 54 - x = dma_alloc_coherent(&bp->pdev->dev, size, y, \ 55 - GFP_KERNEL | __GFP_ZERO); \ 54 + x = dma_zalloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \ 56 55 if (x == NULL) \ 57 56 goto alloc_mem_err; \ 58 57 DP(NETIF_MSG_HW, "BNX2X_PCI_ALLOC: Physical %Lx Virtual %p\n", \
+11 -12
drivers/net/ethernet/broadcom/tg3.c
··· 8591 8591 if (!i && tg3_flag(tp, ENABLE_RSS)) 8592 8592 continue; 8593 8593 8594 - tnapi->rx_rcb = dma_alloc_coherent(&tp->pdev->dev, 8595 - TG3_RX_RCB_RING_BYTES(tp), 8596 - &tnapi->rx_rcb_mapping, 8597 - GFP_KERNEL | __GFP_ZERO); 8594 + tnapi->rx_rcb = dma_zalloc_coherent(&tp->pdev->dev, 8595 + TG3_RX_RCB_RING_BYTES(tp), 8596 + &tnapi->rx_rcb_mapping, 8597 + GFP_KERNEL); 8598 8598 if (!tnapi->rx_rcb) 8599 8599 goto err_out; 8600 8600 } ··· 8643 8643 { 8644 8644 int i; 8645 8645 8646 - tp->hw_stats = dma_alloc_coherent(&tp->pdev->dev, 8647 - sizeof(struct tg3_hw_stats), 8648 - &tp->stats_mapping, 8649 - GFP_KERNEL | __GFP_ZERO); 8646 + tp->hw_stats = dma_zalloc_coherent(&tp->pdev->dev, 8647 + sizeof(struct tg3_hw_stats), 8648 + &tp->stats_mapping, GFP_KERNEL); 8650 8649 if (!tp->hw_stats) 8651 8650 goto err_out; 8652 8651 ··· 8653 8654 struct tg3_napi *tnapi = &tp->napi[i]; 8654 8655 struct tg3_hw_status *sblk; 8655 8656 8656 - tnapi->hw_status = dma_alloc_coherent(&tp->pdev->dev, 8657 - TG3_HW_STATUS_SIZE, 8658 - &tnapi->status_mapping, 8659 - GFP_KERNEL | __GFP_ZERO); 8657 + tnapi->hw_status = dma_zalloc_coherent(&tp->pdev->dev, 8658 + TG3_HW_STATUS_SIZE, 8659 + &tnapi->status_mapping, 8660 + GFP_KERNEL); 8660 8661 if (!tnapi->hw_status) 8661 8662 goto err_out; 8662 8663
+9 -9
drivers/net/ethernet/emulex/benet/be_main.c
··· 145 145 q->len = len; 146 146 q->entry_size = entry_size; 147 147 mem->size = len * entry_size; 148 - mem->va = dma_alloc_coherent(&adapter->pdev->dev, mem->size, &mem->dma, 149 - GFP_KERNEL | __GFP_ZERO); 148 + mem->va = dma_zalloc_coherent(&adapter->pdev->dev, mem->size, &mem->dma, 149 + GFP_KERNEL); 150 150 if (!mem->va) 151 151 return -ENOMEM; 152 152 return 0; ··· 2642 2642 memset(mac, 0, ETH_ALEN); 2643 2643 2644 2644 cmd.size = sizeof(struct be_cmd_req_acpi_wol_magic_config); 2645 - cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, 2646 - GFP_KERNEL | __GFP_ZERO); 2645 + cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, 2646 + GFP_KERNEL); 2647 2647 if (cmd.va == NULL) 2648 2648 return -1; 2649 2649 ··· 3946 3946 memset(mbox_mem_align->va, 0, sizeof(struct be_mcc_mailbox)); 3947 3947 3948 3948 rx_filter->size = sizeof(struct be_cmd_req_rx_filter); 3949 - rx_filter->va = dma_alloc_coherent(&adapter->pdev->dev, rx_filter->size, 3950 - &rx_filter->dma, 3951 - GFP_KERNEL | __GFP_ZERO); 3949 + rx_filter->va = dma_zalloc_coherent(&adapter->pdev->dev, 3950 + rx_filter->size, &rx_filter->dma, 3951 + GFP_KERNEL); 3952 3952 if (rx_filter->va == NULL) { 3953 3953 status = -ENOMEM; 3954 3954 goto free_mbox; ··· 3994 3994 /* BE3 and Skyhawk */ 3995 3995 cmd->size = sizeof(struct be_cmd_req_get_stats_v1); 3996 3996 3997 - cmd->va = dma_alloc_coherent(&adapter->pdev->dev, cmd->size, &cmd->dma, 3998 - GFP_KERNEL | __GFP_ZERO); 3997 + cmd->va = dma_zalloc_coherent(&adapter->pdev->dev, cmd->size, &cmd->dma, 3998 + GFP_KERNEL); 3999 3999 if (cmd->va == NULL) 4000 4000 return -1; 4001 4001 return 0;
+3 -4
drivers/net/ethernet/faraday/ftgmac100.c
··· 778 778 { 779 779 int i; 780 780 781 - priv->descs = dma_alloc_coherent(priv->dev, 782 - sizeof(struct ftgmac100_descs), 783 - &priv->descs_dma_addr, 784 - GFP_KERNEL | __GFP_ZERO); 781 + priv->descs = dma_zalloc_coherent(priv->dev, 782 + sizeof(struct ftgmac100_descs), 783 + &priv->descs_dma_addr, GFP_KERNEL); 785 784 if (!priv->descs) 786 785 return -ENOMEM; 787 786
+4 -4
drivers/net/ethernet/faraday/ftmac100.c
··· 732 732 { 733 733 int i; 734 734 735 - priv->descs = dma_alloc_coherent(priv->dev, 736 - sizeof(struct ftmac100_descs), 737 - &priv->descs_dma_addr, 738 - GFP_KERNEL | __GFP_ZERO); 735 + priv->descs = dma_zalloc_coherent(priv->dev, 736 + sizeof(struct ftmac100_descs), 737 + &priv->descs_dma_addr, 738 + GFP_KERNEL); 739 739 if (!priv->descs) 740 740 return -ENOMEM; 741 741
+2 -2
drivers/net/ethernet/ibm/emac/mal.c
··· 637 637 bd_size = sizeof(struct mal_descriptor) * 638 638 (NUM_TX_BUFF * mal->num_tx_chans + 639 639 NUM_RX_BUFF * mal->num_rx_chans); 640 - mal->bd_virt = dma_alloc_coherent(&ofdev->dev, bd_size, &mal->bd_dma, 641 - GFP_KERNEL | __GFP_ZERO); 640 + mal->bd_virt = dma_zalloc_coherent(&ofdev->dev, bd_size, &mal->bd_dma, 641 + GFP_KERNEL); 642 642 if (mal->bd_virt == NULL) { 643 643 err = -ENOMEM; 644 644 goto fail_unmap;
+4 -4
drivers/net/ethernet/intel/e1000/e1000_ethtool.c
··· 1019 1019 1020 1020 txdr->size = txdr->count * sizeof(struct e1000_tx_desc); 1021 1021 txdr->size = ALIGN(txdr->size, 4096); 1022 - txdr->desc = dma_alloc_coherent(&pdev->dev, txdr->size, &txdr->dma, 1023 - GFP_KERNEL | __GFP_ZERO); 1022 + txdr->desc = dma_zalloc_coherent(&pdev->dev, txdr->size, &txdr->dma, 1023 + GFP_KERNEL); 1024 1024 if (!txdr->desc) { 1025 1025 ret_val = 2; 1026 1026 goto err_nomem; ··· 1077 1077 } 1078 1078 1079 1079 rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc); 1080 - rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma, 1081 - GFP_KERNEL | __GFP_ZERO); 1080 + rxdr->desc = dma_zalloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma, 1081 + GFP_KERNEL); 1082 1082 if (!rxdr->desc) { 1083 1083 ret_val = 6; 1084 1084 goto err_nomem;
+2 -2
drivers/net/ethernet/intel/ixgb/ixgb_main.c
··· 718 718 txdr->size = txdr->count * sizeof(struct ixgb_tx_desc); 719 719 txdr->size = ALIGN(txdr->size, 4096); 720 720 721 - txdr->desc = dma_alloc_coherent(&pdev->dev, txdr->size, &txdr->dma, 722 - GFP_KERNEL | __GFP_ZERO); 721 + txdr->desc = dma_zalloc_coherent(&pdev->dev, txdr->size, &txdr->dma, 722 + GFP_KERNEL); 723 723 if (!txdr->desc) { 724 724 vfree(txdr->buffer_info); 725 725 return -ENOMEM;
+9 -10
drivers/net/ethernet/marvell/pxa168_eth.c
··· 583 583 * table is full. 584 584 */ 585 585 if (pep->htpr == NULL) { 586 - pep->htpr = dma_alloc_coherent(pep->dev->dev.parent, 587 - HASH_ADDR_TABLE_SIZE, 588 - &pep->htpr_dma, 589 - GFP_KERNEL | __GFP_ZERO); 586 + pep->htpr = dma_zalloc_coherent(pep->dev->dev.parent, 587 + HASH_ADDR_TABLE_SIZE, 588 + &pep->htpr_dma, GFP_KERNEL); 590 589 if (pep->htpr == NULL) 591 590 return -ENOMEM; 592 591 } else { ··· 1023 1024 pep->rx_desc_count = 0; 1024 1025 size = pep->rx_ring_size * sizeof(struct rx_desc); 1025 1026 pep->rx_desc_area_size = size; 1026 - pep->p_rx_desc_area = dma_alloc_coherent(pep->dev->dev.parent, size, 1027 - &pep->rx_desc_dma, 1028 - GFP_KERNEL | __GFP_ZERO); 1027 + pep->p_rx_desc_area = dma_zalloc_coherent(pep->dev->dev.parent, size, 1028 + &pep->rx_desc_dma, 1029 + GFP_KERNEL); 1029 1030 if (!pep->p_rx_desc_area) 1030 1031 goto out; 1031 1032 ··· 1084 1085 pep->tx_desc_count = 0; 1085 1086 size = pep->tx_ring_size * sizeof(struct tx_desc); 1086 1087 pep->tx_desc_area_size = size; 1087 - pep->p_tx_desc_area = dma_alloc_coherent(pep->dev->dev.parent, size, 1088 - &pep->tx_desc_dma, 1089 - GFP_KERNEL | __GFP_ZERO); 1088 + pep->p_tx_desc_area = dma_zalloc_coherent(pep->dev->dev.parent, size, 1089 + &pep->tx_desc_dma, 1090 + GFP_KERNEL); 1090 1091 if (!pep->p_tx_desc_area) 1091 1092 goto out; 1092 1093 /* Initialize the next_desc_ptr links in the Tx descriptors ring */
+3 -3
drivers/net/ethernet/myricom/myri10ge/myri10ge.c
··· 3783 3783 for (i = 0; i < mgp->num_slices; i++) { 3784 3784 ss = &mgp->ss[i]; 3785 3785 bytes = mgp->max_intr_slots * sizeof(*ss->rx_done.entry); 3786 - ss->rx_done.entry = dma_alloc_coherent(&pdev->dev, bytes, 3787 - &ss->rx_done.bus, 3788 - GFP_KERNEL | __GFP_ZERO); 3786 + ss->rx_done.entry = dma_zalloc_coherent(&pdev->dev, bytes, 3787 + &ss->rx_done.bus, 3788 + GFP_KERNEL); 3789 3789 if (ss->rx_done.entry == NULL) 3790 3790 goto abort; 3791 3791 bytes = sizeof(*ss->fw_stats);
+7 -9
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
··· 1491 1491 bufsz = adapter->rx_buffer_len; 1492 1492 1493 1493 size = rx_ring->count * bufsz + PCH_GBE_RESERVE_MEMORY; 1494 - rx_ring->rx_buff_pool = dma_alloc_coherent(&pdev->dev, size, 1495 - &rx_ring->rx_buff_pool_logic, 1496 - GFP_KERNEL | __GFP_ZERO); 1494 + rx_ring->rx_buff_pool = 1495 + dma_zalloc_coherent(&pdev->dev, size, 1496 + &rx_ring->rx_buff_pool_logic, GFP_KERNEL); 1497 1497 if (!rx_ring->rx_buff_pool) 1498 1498 return -ENOMEM; 1499 1499 ··· 1807 1807 1808 1808 tx_ring->size = tx_ring->count * (int)sizeof(struct pch_gbe_tx_desc); 1809 1809 1810 - tx_ring->desc = dma_alloc_coherent(&pdev->dev, tx_ring->size, 1811 - &tx_ring->dma, 1812 - GFP_KERNEL | __GFP_ZERO); 1810 + tx_ring->desc = dma_zalloc_coherent(&pdev->dev, tx_ring->size, 1811 + &tx_ring->dma, GFP_KERNEL); 1813 1812 if (!tx_ring->desc) { 1814 1813 vfree(tx_ring->buffer_info); 1815 1814 return -ENOMEM; ··· 1851 1852 return -ENOMEM; 1852 1853 1853 1854 rx_ring->size = rx_ring->count * (int)sizeof(struct pch_gbe_rx_desc); 1854 - rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size, 1855 - &rx_ring->dma, 1856 - GFP_KERNEL | __GFP_ZERO); 1855 + rx_ring->desc = dma_zalloc_coherent(&pdev->dev, rx_ring->size, 1856 + &rx_ring->dma, GFP_KERNEL); 1857 1857 if (!rx_ring->desc) { 1858 1858 vfree(rx_ring->buffer_info); 1859 1859 return -ENOMEM;
+3 -4
drivers/net/ethernet/pasemi/pasemi_mac.c
··· 440 440 if (pasemi_dma_alloc_ring(&ring->chan, RX_RING_SIZE)) 441 441 goto out_ring_desc; 442 442 443 - ring->buffers = dma_alloc_coherent(&mac->dma_pdev->dev, 444 - RX_RING_SIZE * sizeof(u64), 445 - &ring->buf_dma, 446 - GFP_KERNEL | __GFP_ZERO); 443 + ring->buffers = dma_zalloc_coherent(&mac->dma_pdev->dev, 444 + RX_RING_SIZE * sizeof(u64), 445 + &ring->buf_dma, GFP_KERNEL); 447 446 if (!ring->buffers) 448 447 goto out_ring_desc; 449 448
+14 -15
drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
··· 448 448 *(tx_ring->hw_consumer) = 0; 449 449 450 450 rq_size = SIZEOF_HOSTRQ_TX(struct qlcnic_hostrq_tx_ctx); 451 - rq_addr = dma_alloc_coherent(&adapter->pdev->dev, rq_size, 452 - &rq_phys_addr, GFP_KERNEL | __GFP_ZERO); 451 + rq_addr = dma_zalloc_coherent(&adapter->pdev->dev, rq_size, 452 + &rq_phys_addr, GFP_KERNEL); 453 453 if (!rq_addr) 454 454 return -ENOMEM; 455 455 456 456 rsp_size = SIZEOF_CARDRSP_TX(struct qlcnic_cardrsp_tx_ctx); 457 - rsp_addr = dma_alloc_coherent(&adapter->pdev->dev, rsp_size, 458 - &rsp_phys_addr, GFP_KERNEL | __GFP_ZERO); 457 + rsp_addr = dma_zalloc_coherent(&adapter->pdev->dev, rsp_size, 458 + &rsp_phys_addr, GFP_KERNEL); 459 459 if (!rsp_addr) { 460 460 err = -ENOMEM; 461 461 goto out_free_rq; ··· 865 865 struct qlcnic_cmd_args cmd; 866 866 size_t nic_size = sizeof(struct qlcnic_info_le); 867 867 868 - nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size, 869 - &nic_dma_t, GFP_KERNEL | __GFP_ZERO); 868 + nic_info_addr = dma_zalloc_coherent(&adapter->pdev->dev, nic_size, 869 + &nic_dma_t, GFP_KERNEL); 870 870 if (!nic_info_addr) 871 871 return -ENOMEM; 872 872 ··· 919 919 if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC) 920 920 return err; 921 921 922 - nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size, 923 - &nic_dma_t, GFP_KERNEL | __GFP_ZERO); 922 + nic_info_addr = dma_zalloc_coherent(&adapter->pdev->dev, nic_size, 923 + &nic_dma_t, GFP_KERNEL); 924 924 if (!nic_info_addr) 925 925 return -ENOMEM; 926 926 ··· 972 972 size_t npar_size = sizeof(struct qlcnic_pci_info_le); 973 973 size_t pci_size = npar_size * QLCNIC_MAX_PCI_FUNC; 974 974 975 - pci_info_addr = dma_alloc_coherent(&adapter->pdev->dev, pci_size, 976 - &pci_info_dma_t, 977 - GFP_KERNEL | __GFP_ZERO); 975 + pci_info_addr = dma_zalloc_coherent(&adapter->pdev->dev, pci_size, 976 + &pci_info_dma_t, GFP_KERNEL); 978 977 if (!pci_info_addr) 979 978 return -ENOMEM; 980 979 ··· 1073 1074 return -EIO; 1074 1075 } 1075 1076 1076 - stats_addr = dma_alloc_coherent(&adapter->pdev->dev, stats_size, 1077 - &stats_dma_t, GFP_KERNEL | __GFP_ZERO); 1077 + stats_addr = dma_zalloc_coherent(&adapter->pdev->dev, stats_size, 1078 + &stats_dma_t, GFP_KERNEL); 1078 1079 if (!stats_addr) 1079 1080 return -ENOMEM; 1080 1081 ··· 1129 1130 if (mac_stats == NULL) 1130 1131 return -ENOMEM; 1131 1132 1132 - stats_addr = dma_alloc_coherent(&adapter->pdev->dev, stats_size, 1133 - &stats_dma_t, GFP_KERNEL | __GFP_ZERO); 1133 + stats_addr = dma_zalloc_coherent(&adapter->pdev->dev, stats_size, 1134 + &stats_dma_t, GFP_KERNEL); 1134 1135 if (!stats_addr) 1135 1136 return -ENOMEM; 1136 1137
+2 -3
drivers/net/ethernet/sfc/nic.c
··· 33 33 int efx_nic_alloc_buffer(struct efx_nic *efx, struct efx_buffer *buffer, 34 34 unsigned int len, gfp_t gfp_flags) 35 35 { 36 - buffer->addr = dma_alloc_coherent(&efx->pci_dev->dev, len, 37 - &buffer->dma_addr, 38 - gfp_flags | __GFP_ZERO); 36 + buffer->addr = dma_zalloc_coherent(&efx->pci_dev->dev, len, 37 + &buffer->dma_addr, gfp_flags); 39 38 if (!buffer->addr) 40 39 return -ENOMEM; 41 40 buffer->len = len;
+2 -3
drivers/net/ethernet/sgi/meth.c
··· 212 212 static int meth_init_tx_ring(struct meth_private *priv) 213 213 { 214 214 /* Init TX ring */ 215 - priv->tx_ring = dma_alloc_coherent(NULL, TX_RING_BUFFER_SIZE, 216 - &priv->tx_ring_dma, 217 - GFP_ATOMIC | __GFP_ZERO); 215 + priv->tx_ring = dma_zalloc_coherent(NULL, TX_RING_BUFFER_SIZE, 216 + &priv->tx_ring_dma, GFP_ATOMIC); 218 217 if (!priv->tx_ring) 219 218 return -ENOMEM; 220 219
+4 -4
drivers/net/ethernet/tundra/tsi108_eth.c
··· 1308 1308 data->id, dev->irq, dev->name); 1309 1309 } 1310 1310 1311 - data->rxring = dma_alloc_coherent(NULL, rxring_size, &data->rxdma, 1312 - GFP_KERNEL | __GFP_ZERO); 1311 + data->rxring = dma_zalloc_coherent(NULL, rxring_size, &data->rxdma, 1312 + GFP_KERNEL); 1313 1313 if (!data->rxring) 1314 1314 return -ENOMEM; 1315 1315 1316 - data->txring = dma_alloc_coherent(NULL, txring_size, &data->txdma, 1317 - GFP_KERNEL | __GFP_ZERO); 1316 + data->txring = dma_zalloc_coherent(NULL, txring_size, &data->txdma, 1317 + GFP_KERNEL); 1318 1318 if (!data->txring) { 1319 1319 pci_free_consistent(0, rxring_size, data->rxring, data->rxdma); 1320 1320 return -ENOMEM;
+6 -6
drivers/net/ethernet/xilinx/ll_temac_main.c
··· 243 243 244 244 /* allocate the tx and rx ring buffer descriptors. */ 245 245 /* returns a virtual address and a physical address. */ 246 - lp->tx_bd_v = dma_alloc_coherent(ndev->dev.parent, 247 - sizeof(*lp->tx_bd_v) * TX_BD_NUM, 248 - &lp->tx_bd_p, GFP_KERNEL | __GFP_ZERO); 246 + lp->tx_bd_v = dma_zalloc_coherent(ndev->dev.parent, 247 + sizeof(*lp->tx_bd_v) * TX_BD_NUM, 248 + &lp->tx_bd_p, GFP_KERNEL); 249 249 if (!lp->tx_bd_v) 250 250 goto out; 251 251 252 - lp->rx_bd_v = dma_alloc_coherent(ndev->dev.parent, 253 - sizeof(*lp->rx_bd_v) * RX_BD_NUM, 254 - &lp->rx_bd_p, GFP_KERNEL | __GFP_ZERO); 252 + lp->rx_bd_v = dma_zalloc_coherent(ndev->dev.parent, 253 + sizeof(*lp->rx_bd_v) * RX_BD_NUM, 254 + &lp->rx_bd_p, GFP_KERNEL); 255 255 if (!lp->rx_bd_v) 256 256 goto out; 257 257
+6 -8
drivers/net/ethernet/xilinx/xilinx_axienet_main.c
··· 201 201 /* 202 202 * Allocate the Tx and Rx buffer descriptors. 203 203 */ 204 - lp->tx_bd_v = dma_alloc_coherent(ndev->dev.parent, 205 - sizeof(*lp->tx_bd_v) * TX_BD_NUM, 206 - &lp->tx_bd_p, 207 - GFP_KERNEL | __GFP_ZERO); 204 + lp->tx_bd_v = dma_zalloc_coherent(ndev->dev.parent, 205 + sizeof(*lp->tx_bd_v) * TX_BD_NUM, 206 + &lp->tx_bd_p, GFP_KERNEL); 208 207 if (!lp->tx_bd_v) 209 208 goto out; 210 209 211 - lp->rx_bd_v = dma_alloc_coherent(ndev->dev.parent, 212 - sizeof(*lp->rx_bd_v) * RX_BD_NUM, 213 - &lp->rx_bd_p, 214 - GFP_KERNEL | __GFP_ZERO); 210 + lp->rx_bd_v = dma_zalloc_coherent(ndev->dev.parent, 211 + sizeof(*lp->rx_bd_v) * RX_BD_NUM, 212 + &lp->rx_bd_p, GFP_KERNEL); 215 213 if (!lp->rx_bd_v) 216 214 goto out; 217 215
+3 -3
drivers/net/fddi/defxx.c
··· 1068 1068 #endif 1069 1069 sizeof(PI_CONSUMER_BLOCK) + 1070 1070 (PI_ALIGN_K_DESC_BLK - 1); 1071 - bp->kmalloced = top_v = dma_alloc_coherent(bp->bus_dev, alloc_size, 1072 - &bp->kmalloced_dma, 1073 - GFP_ATOMIC | __GFP_ZERO); 1071 + bp->kmalloced = top_v = dma_zalloc_coherent(bp->bus_dev, alloc_size, 1072 + &bp->kmalloced_dma, 1073 + GFP_ATOMIC); 1074 1074 if (top_v == NULL) 1075 1075 return DFX_K_FAILURE; 1076 1076
+4 -4
drivers/net/irda/ali-ircc.c
··· 351 351 352 352 /* Allocate memory if needed */ 353 353 self->rx_buff.head = 354 - dma_alloc_coherent(NULL, self->rx_buff.truesize, 355 - &self->rx_buff_dma, GFP_KERNEL | __GFP_ZERO); 354 + dma_zalloc_coherent(NULL, self->rx_buff.truesize, 355 + &self->rx_buff_dma, GFP_KERNEL); 356 356 if (self->rx_buff.head == NULL) { 357 357 err = -ENOMEM; 358 358 goto err_out2; 359 359 } 360 360 361 361 self->tx_buff.head = 362 - dma_alloc_coherent(NULL, self->tx_buff.truesize, 363 - &self->tx_buff_dma, GFP_KERNEL | __GFP_ZERO); 362 + dma_zalloc_coherent(NULL, self->tx_buff.truesize, 363 + &self->tx_buff_dma, GFP_KERNEL); 364 364 if (self->tx_buff.head == NULL) { 365 365 err = -ENOMEM; 366 366 goto err_out3;
+4 -4
drivers/net/irda/nsc-ircc.c
··· 430 430 431 431 /* Allocate memory if needed */ 432 432 self->rx_buff.head = 433 - dma_alloc_coherent(NULL, self->rx_buff.truesize, 434 - &self->rx_buff_dma, GFP_KERNEL | __GFP_ZERO); 433 + dma_zalloc_coherent(NULL, self->rx_buff.truesize, 434 + &self->rx_buff_dma, GFP_KERNEL); 435 435 if (self->rx_buff.head == NULL) { 436 436 err = -ENOMEM; 437 437 goto out2; ··· 439 439 } 440 440 441 441 self->tx_buff.head = 442 - dma_alloc_coherent(NULL, self->tx_buff.truesize, 443 - &self->tx_buff_dma, GFP_KERNEL | __GFP_ZERO); 442 + dma_zalloc_coherent(NULL, self->tx_buff.truesize, 443 + &self->tx_buff_dma, GFP_KERNEL); 444 444 if (self->tx_buff.head == NULL) { 445 445 err = -ENOMEM; 446 446 goto out3;
+4 -4
drivers/net/irda/smsc-ircc2.c
··· 562 562 self->tx_buff.truesize = SMSC_IRCC2_TX_BUFF_TRUESIZE; 563 563 564 564 self->rx_buff.head = 565 - dma_alloc_coherent(NULL, self->rx_buff.truesize, 566 - &self->rx_buff_dma, GFP_KERNEL | __GFP_ZERO); 565 + dma_zalloc_coherent(NULL, self->rx_buff.truesize, 566 + &self->rx_buff_dma, GFP_KERNEL); 567 567 if (self->rx_buff.head == NULL) 568 568 goto err_out2; 569 569 570 570 self->tx_buff.head = 571 - dma_alloc_coherent(NULL, self->tx_buff.truesize, 572 - &self->tx_buff_dma, GFP_KERNEL | __GFP_ZERO); 571 + dma_zalloc_coherent(NULL, self->tx_buff.truesize, 572 + &self->tx_buff_dma, GFP_KERNEL); 573 573 if (self->tx_buff.head == NULL) 574 574 goto err_out3; 575 575
+4 -4
drivers/net/irda/via-ircc.c
··· 361 361 362 362 /* Allocate memory if needed */ 363 363 self->rx_buff.head = 364 - dma_alloc_coherent(&pdev->dev, self->rx_buff.truesize, 365 - &self->rx_buff_dma, GFP_KERNEL | __GFP_ZERO); 364 + dma_zalloc_coherent(&pdev->dev, self->rx_buff.truesize, 365 + &self->rx_buff_dma, GFP_KERNEL); 366 366 if (self->rx_buff.head == NULL) { 367 367 err = -ENOMEM; 368 368 goto err_out2; 369 369 } 370 370 371 371 self->tx_buff.head = 372 - dma_alloc_coherent(&pdev->dev, self->tx_buff.truesize, 373 - &self->tx_buff_dma, GFP_KERNEL | __GFP_ZERO); 372 + dma_zalloc_coherent(&pdev->dev, self->tx_buff.truesize, 373 + &self->tx_buff_dma, GFP_KERNEL); 374 374 if (self->tx_buff.head == NULL) { 375 375 err = -ENOMEM; 376 376 goto err_out3;
+4 -4
drivers/net/irda/w83977af_ir.c
··· 215 215 216 216 /* Allocate memory if needed */ 217 217 self->rx_buff.head = 218 - dma_alloc_coherent(NULL, self->rx_buff.truesize, 219 - &self->rx_buff_dma, GFP_KERNEL | __GFP_ZERO); 218 + dma_zalloc_coherent(NULL, self->rx_buff.truesize, 219 + &self->rx_buff_dma, GFP_KERNEL); 220 220 if (self->rx_buff.head == NULL) { 221 221 err = -ENOMEM; 222 222 goto err_out1; 223 223 } 224 224 225 225 self->tx_buff.head = 226 - dma_alloc_coherent(NULL, self->tx_buff.truesize, 227 - &self->tx_buff_dma, GFP_KERNEL | __GFP_ZERO); 226 + dma_zalloc_coherent(NULL, self->tx_buff.truesize, 227 + &self->tx_buff_dma, GFP_KERNEL); 228 228 if (self->tx_buff.head == NULL) { 229 229 err = -ENOMEM; 230 230 goto err_out2;
+3 -3
drivers/net/wireless/b43/dma.c
··· 431 431 u16 ring_mem_size = (ring->type == B43_DMA_64BIT) ? 432 432 B43_DMA64_RINGMEMSIZE : B43_DMA32_RINGMEMSIZE; 433 433 434 - ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev, 435 - ring_mem_size, &(ring->dmabase), 436 - GFP_KERNEL | __GFP_ZERO); 434 + ring->descbase = dma_zalloc_coherent(ring->dev->dev->dma_dev, 435 + ring_mem_size, &(ring->dmabase), 436 + GFP_KERNEL); 437 437 if (!ring->descbase) 438 438 return -ENOMEM; 439 439
+3 -4
drivers/net/wireless/b43legacy/dma.c
··· 331 331 static int alloc_ringmemory(struct b43legacy_dmaring *ring) 332 332 { 333 333 /* GFP flags must match the flags in free_ringmemory()! */ 334 - ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev, 335 - B43legacy_DMA_RINGMEMSIZE, 336 - &(ring->dmabase), 337 - GFP_KERNEL | __GFP_ZERO); 334 + ring->descbase = dma_zalloc_coherent(ring->dev->dev->dma_dev, 335 + B43legacy_DMA_RINGMEMSIZE, 336 + &(ring->dmabase), GFP_KERNEL); 338 337 if (!ring->descbase) 339 338 return -ENOMEM; 340 339
+2 -3
include/linux/dma-mapping.h
··· 132 132 static inline void *dma_zalloc_coherent(struct device *dev, size_t size, 133 133 dma_addr_t *dma_handle, gfp_t flag) 134 134 { 135 - void *ret = dma_alloc_coherent(dev, size, dma_handle, flag); 136 - if (ret) 137 - memset(ret, 0, size); 135 + void *ret = dma_alloc_coherent(dev, size, dma_handle, 136 + flag | __GFP_ZERO); 138 137 return ret; 139 138 } 140 139