RDMA/qedr: Use zeroing memory allocator than allocator/memset
authorHimanshu Jha <himanshujha199640@gmail.com>
Sun, 31 Dec 2017 12:31:03 +0000 (18:01 +0530)
committerJason Gunthorpe <jgg@mellanox.com>
Tue, 2 Jan 2018 18:20:13 +0000 (11:20 -0700)
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 <mcgrof@kernel.org>
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Acked-by: Ram Amrani <Ram.Amrani@cavium.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/qedr/verbs.c

index b26aa88dab48a09f877cc0c022fb558e7f26bff9..3b9c89848d66988ec18d8946acbb2ab817d51c0a 100644 (file)
@@ -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;
        }