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: Luis R. Rodriguez <[email protected]>
Signed-off-by: Himanshu Jha <[email protected]>
---
drivers/infiniband/hw/qedr/verbs.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
index b26aa88..3b9c898 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -604,12 +604,11 @@ static struct qedr_pbl *qedr_alloc_pbl_tbl(struct qedr_dev *dev,
return ERR_PTR(-ENOMEM);
for (i = 0; i < pbl_info->num_pbls; i++) {
- va = dma_alloc_coherent(&pdev->dev, pbl_info->pbl_size,
- &pa, flags);
+ va = dma_zalloc_coherent(&pdev->dev, pbl_info->pbl_size,
+ &pa, flags);
if (!va)
goto err;
- memset(va, 0, pbl_info->pbl_size);
pbl_table[i].va = va;
pbl_table[i].pa = pa;
}
--
2.7.4
> 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: Luis R. Rodriguez <[email protected]>
> Signed-off-by: Himanshu Jha <[email protected]>
> ---
> drivers/infiniband/hw/qedr/verbs.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
> index b26aa88..3b9c898 100644
> --- a/drivers/infiniband/hw/qedr/verbs.c
> +++ b/drivers/infiniband/hw/qedr/verbs.c
> @@ -604,12 +604,11 @@ static struct qedr_pbl *qedr_alloc_pbl_tbl(struct qedr_dev *dev,
> return ERR_PTR(-ENOMEM);
>
> for (i = 0; i < pbl_info->num_pbls; i++) {
> - va = dma_alloc_coherent(&pdev->dev, pbl_info->pbl_size,
> - &pa, flags);
> + va = dma_zalloc_coherent(&pdev->dev, pbl_info->pbl_size,
> + &pa, flags);
> if (!va)
> goto err;
>
> - memset(va, 0, pbl_info->pbl_size);
> pbl_table[i].va = va;
> pbl_table[i].pa = pa;
> }
> --
> 2.7.4
Acked-by: Ram Amrani <[email protected]>
Thanks,
Ram
On Sun, Dec 31, 2017 at 06:01:03PM +0530, Himanshu Jha wrote:
> 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: Luis R. Rodriguez <[email protected]>
> Signed-off-by: Himanshu Jha <[email protected]>
> Acked-by: Ram Amrani <[email protected]>
> drivers/infiniband/hw/qedr/verbs.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
Applied to for-next thanks
Jason