net: hix5hd2_gmac: use dma_zalloc_coherent instead of allocator/memset
authorYueHaibing <yuehaibing@huawei.com>
Thu, 19 Jul 2018 13:57:11 +0000 (21:57 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 21 Jul 2018 23:31:23 +0000 (16:31 -0700)
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>
drivers/net/ethernet/hisilicon/hix5hd2_gmac.c

index 25a6c87..c572700 100644 (file)
@@ -1006,12 +1006,11 @@ static int hix5hd2_init_hw_desc_queue(struct hix5hd2_priv *priv)
 
        for (i = 0; i < QUEUE_NUMS; i++) {
                size = priv->pool[i].count * sizeof(struct hix5hd2_desc);
-               virt_addr = dma_alloc_coherent(dev, size, &phys_addr,
-                                              GFP_KERNEL);
+               virt_addr = dma_zalloc_coherent(dev, size, &phys_addr,
+                                               GFP_KERNEL);
                if (virt_addr == NULL)
                        goto error_free_pool;
 
-               memset(virt_addr, 0, size);
                priv->pool[i].size = size;
                priv->pool[i].desc = virt_addr;
                priv->pool[i].phys_addr = phys_addr;