All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/qedr: Use zeroing memory allocator than allocator/memset
@ 2017-12-31 12:31 Himanshu Jha
  2017-12-31 13:09 ` Amrani, Ram
       [not found] ` <1514723463-5859-1-git-send-email-himanshujha199640-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Himanshu Jha @ 2017-12-31 12:31 UTC (permalink / raw)
  To: dledford
  Cc: Ram.Amrani, Michal.Kalderon, Ariel.Elior, jgg, linux-rdma,
	linux-kernel, Himanshu Jha

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>
---
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] RDMA/qedr: Use zeroing memory allocator than allocator/memset
  2017-12-31 12:31 [PATCH] RDMA/qedr: Use zeroing memory allocator than allocator/memset Himanshu Jha
@ 2017-12-31 13:09 ` Amrani, Ram
       [not found] ` <1514723463-5859-1-git-send-email-himanshujha199640-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Amrani, Ram @ 2017-12-31 13:09 UTC (permalink / raw)
  To: Himanshu Jha, dledford
  Cc: Kalderon, Michal, Elior, Ariel, jgg, linux-rdma, linux-kernel

> 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>
> ---
>  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 <Ram.Amrani@cavium.com>

Thanks,
Ram

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] RDMA/qedr: Use zeroing memory allocator than allocator/memset
  2017-12-31 12:31 [PATCH] RDMA/qedr: Use zeroing memory allocator than allocator/memset Himanshu Jha
@ 2018-01-02 21:06     ` Jason Gunthorpe
       [not found] ` <1514723463-5859-1-git-send-email-himanshujha199640-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2018-01-02 21:06 UTC (permalink / raw)
  To: Himanshu Jha
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA,
	Michal.Kalderon-YGCgFSpz5w/QT0dZR+AlfA,
	Ariel.Elior-YGCgFSpz5w/QT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

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 <mcgrof-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Signed-off-by: Himanshu Jha <himanshujha199640-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Acked-by: Ram Amrani <Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
>  drivers/infiniband/hw/qedr/verbs.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

Applied to for-next thanks

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] RDMA/qedr: Use zeroing memory allocator than allocator/memset
@ 2018-01-02 21:06     ` Jason Gunthorpe
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2018-01-02 21:06 UTC (permalink / raw)
  To: Himanshu Jha
  Cc: dledford, Ram.Amrani, Michal.Kalderon, Ariel.Elior, linux-rdma,
	linux-kernel

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 <mcgrof@kernel.org>
> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
> Acked-by: Ram Amrani <Ram.Amrani@cavium.com>
>  drivers/infiniband/hw/qedr/verbs.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

Applied to for-next thanks

Jason

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-02 21:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-31 12:31 [PATCH] RDMA/qedr: Use zeroing memory allocator than allocator/memset Himanshu Jha
2017-12-31 13:09 ` Amrani, Ram
     [not found] ` <1514723463-5859-1-git-send-email-himanshujha199640-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-01-02 21:06   ` Jason Gunthorpe
2018-01-02 21:06     ` Jason Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.