Skip to content

Commit

Permalink
net: mediatek: use dma_zalloc_coherent instead of allocator/memset
Browse files Browse the repository at this point in the history
Use dma_zalloc_coherent instead of dma_alloc_coherent
followed by memset 0.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
YueHaibing authored and David S. Miller committed Jul 23, 2018
1 parent 07300f7 commit 0a78c38
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/net/ethernet/mediatek/mtk_eth_soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1221,14 +1221,11 @@ static int mtk_tx_alloc(struct mtk_eth *eth)
if (!ring->buf)
goto no_tx_mem;

ring->dma = dma_alloc_coherent(eth->dev,
MTK_DMA_SIZE * sz,
&ring->phys,
GFP_ATOMIC | __GFP_ZERO);
ring->dma = dma_zalloc_coherent(eth->dev, MTK_DMA_SIZE * sz,
&ring->phys, GFP_ATOMIC);
if (!ring->dma)
goto no_tx_mem;

memset(ring->dma, 0, MTK_DMA_SIZE * sz);
for (i = 0; i < MTK_DMA_SIZE; i++) {
int next = (i + 1) % MTK_DMA_SIZE;
u32 next_ptr = ring->phys + next * sz;
Expand Down

0 comments on commit 0a78c38

Please sign in to comment.