Commit 7bced914 authored by Himanshu Jha's avatar Himanshu Jha Committed by Jason Gunthorpe

RDMA/qedr: Use zeroing memory allocator than allocator/memset

Use dma_zalloc_coherent for allocating zeroed
memory and remove unnecessary memset function.

Done using Coccinelle.
Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
0-day tested with no failures.
Suggested-by: default avatarLuis R. Rodriguez <mcgrof@kernel.org>
Signed-off-by: default avatarHimanshu Jha <himanshujha199640@gmail.com>
Acked-by: default avatarRam Amrani <Ram.Amrani@cavium.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 58355656
...@@ -604,12 +604,11 @@ static struct qedr_pbl *qedr_alloc_pbl_tbl(struct qedr_dev *dev, ...@@ -604,12 +604,11 @@ static struct qedr_pbl *qedr_alloc_pbl_tbl(struct qedr_dev *dev,
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
for (i = 0; i < pbl_info->num_pbls; i++) { for (i = 0; i < pbl_info->num_pbls; i++) {
va = dma_alloc_coherent(&pdev->dev, pbl_info->pbl_size, va = dma_zalloc_coherent(&pdev->dev, pbl_info->pbl_size,
&pa, flags); &pa, flags);
if (!va) if (!va)
goto err; goto err;
memset(va, 0, pbl_info->pbl_size);
pbl_table[i].va = va; pbl_table[i].va = va;
pbl_table[i].pa = pa; pbl_table[i].pa = pa;
} }
......
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