Commit 5298ff58 authored by zhong jiang's avatar zhong jiang Committed by Greg Kroah-Hartman

drivers/staging/mt7621-eth: Use dma_zalloc_coherent to replace dma_alloc_coherent+memset

we prefer to use dma_zalloc_coherent rather than dam_alloc_coherent+memset
Signed-off-by: default avatarzhong jiang <zhongjiang@huawei.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 500cc548
...@@ -1396,14 +1396,13 @@ static int mtk_qdma_tx_alloc_tx(struct mtk_eth *eth) ...@@ -1396,14 +1396,13 @@ static int mtk_qdma_tx_alloc_tx(struct mtk_eth *eth)
if (!ring->tx_buf) if (!ring->tx_buf)
goto no_tx_mem; goto no_tx_mem;
ring->tx_dma = dma_alloc_coherent(eth->dev, ring->tx_dma = dma_zalloc_coherent(eth->dev,
ring->tx_ring_size * sz, ring->tx_ring_size * sz,
&ring->tx_phys, &ring->tx_phys,
GFP_ATOMIC | __GFP_ZERO); GFP_ATOMIC | __GFP_ZERO);
if (!ring->tx_dma) if (!ring->tx_dma)
goto no_tx_mem; goto no_tx_mem;
memset(ring->tx_dma, 0, ring->tx_ring_size * sz);
for (i = 0; i < ring->tx_ring_size; i++) { for (i = 0; i < ring->tx_ring_size; i++) {
int next = (i + 1) % ring->tx_ring_size; int next = (i + 1) % ring->tx_ring_size;
u32 next_ptr = ring->tx_phys + next * sz; u32 next_ptr = ring->tx_phys + next * sz;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment