Commit ff2e351e authored by YueHaibing's avatar YueHaibing Committed by David S. Miller
Browse files

qed: use dma_zalloc_coherent instead of allocator/memset



Use dma_zalloc_coherent instead of dma_alloc_coherent
followed by memset 0.

Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Acked-by: default avatarTomer Tayar <Tomer.Tayar@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1f55c286
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -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;
	}