qed: use dma_zalloc_coherent instead of allocator/memset
authorYueHaibing <yuehaibing@huawei.com>
Mon, 4 Jun 2018 13:10:31 +0000 (21:10 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 4 Jun 2018 21:28:43 +0000 (17:28 -0400)
Use dma_zalloc_coherent instead of dma_alloc_coherent
followed by memset 0.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Tomer Tayar <Tomer.Tayar@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qed/qed_cxt.c

index 7ed6aa0521e1e4c5f32c8148f343295edd38bddd..b5b5ff725426c13b5c379cfe788ff4d73e50480c 100644 (file)
@@ -937,14 +937,13 @@ static int qed_cxt_src_t2_alloc(struct qed_hwfn *p_hwfn)
                u32 size = min_t(u32, total_size, psz);
                void **p_virt = &p_mngr->t2[i].p_virt;
 
-               *p_virt = dma_alloc_coherent(&p_hwfn->cdev->pdev->dev,
-                                            size,
-                                            &p_mngr->t2[i].p_phys, GFP_KERNEL);
+               *p_virt = dma_zalloc_coherent(&p_hwfn->cdev->pdev->dev,
+                                             size, &p_mngr->t2[i].p_phys,
+                                             GFP_KERNEL);
                if (!p_mngr->t2[i].p_virt) {
                        rc = -ENOMEM;
                        goto t2_fail;
                }
-               memset(*p_virt, 0, size);
                p_mngr->t2[i].size = size;
                total_size -= size;
        }