diff mbox

rdma/cxgb4: fix zalloc-simple.cocci warnings

Message ID alpine.DEB.2.20.1803191210230.3392@hadrien (mailing list archive)
State Superseded
Headers show

Commit Message

Julia Lawall March 19, 2018, 11:11 a.m. UTC
From: Fengguang Wu <fengguang.wu@intel.com>

 Use zeroing allocator rather than allocator followed by memset with 0

Generated by: scripts/coccinelle/api/alloc/zalloc-simple.cocci

CC: Raju Rangoju <rajur@chelsio.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>

---

url:
https://github.com/0day-ci/linux/commits/Raju-Rangoju/rdma-cxgb4-Add-SRQ-support-for-Chelsio-adapters/20180313-062514
:::::: branch date: 7 days ago
:::::: commit date: 7 days ago

 qp.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

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

Comments

Raju Rangoju March 19, 2018, 12:25 p.m. UTC | #1
Thanks for pointing this out. I will fix it.

On Monday, March 03/19/18, 2018 at 12:11:55 +0100, Julia Lawall wrote:
> From: Fengguang Wu <fengguang.wu@intel.com>
> 
>  Use zeroing allocator rather than allocator followed by memset with 0
> 
> Generated by: scripts/coccinelle/api/alloc/zalloc-simple.cocci
> 
> CC: Raju Rangoju <rajur@chelsio.com>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
> 
> ---
> 
> url:
> https://github.com/0day-ci/linux/commits/Raju-Rangoju/rdma-cxgb4-Add-SRQ-support-for-Chelsio-adapters/20180313-062514
> :::::: branch date: 7 days ago
> :::::: commit date: 7 days ago
> 
>  qp.c |    6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> --- a/drivers/infiniband/hw/cxgb4/qp.c
> +++ b/drivers/infiniband/hw/cxgb4/qp.c
> @@ -2377,13 +2377,11 @@ static int alloc_srq_queue(struct c4iw_s
>  	wq->rqt_abs_idx = (wq->rqt_hwaddr - rdev->lldi.vr->rq.start) >>
>  		T4_RQT_ENTRY_SHIFT;
> 
> -	wq->queue = dma_alloc_coherent(&(rdev->lldi.pdev->dev),
> -			wq->memsize, &(wq->dma_addr),
> -			GFP_KERNEL);
> +	wq->queue = dma_zalloc_coherent(&(rdev->lldi.pdev->dev), wq->memsize,
> +					&(wq->dma_addr), GFP_KERNEL);
>  	if (!wq->queue)
>  		goto err_free_rqtpool;
> 
> -	memset(wq->queue, 0, wq->memsize);
>  	pci_unmap_addr_set(wq, mapping, wq->dma_addr);
> 
>  	wq->bar2_va = c4iw_bar2_addrs(rdev, wq->qid, T4_BAR2_QTYPE_EGRESS,
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jason Gunthorpe March 19, 2018, 3:18 p.m. UTC | #2
On Mon, Mar 19, 2018 at 05:55:29PM +0530, Raju Rangoju wrote:
> Thanks for pointing this out. I will fix it.

When you say 'I will fix it', do you want me to apply this patch from
Julia or do you plan something else? It looks fine to me.

Jason

> On Monday, March 03/19/18, 2018 at 12:11:55 +0100, Julia Lawall wrote:
> > From: Fengguang Wu <fengguang.wu@intel.com>
> > 
> >  Use zeroing allocator rather than allocator followed by memset with 0
> > 
> > Generated by: scripts/coccinelle/api/alloc/zalloc-simple.cocci
> > 
> > CC: Raju Rangoju <rajur@chelsio.com>
> > Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> > Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
> > 
> > 
> > url:
> > https://github.com/0day-ci/linux/commits/Raju-Rangoju/rdma-cxgb4-Add-SRQ-support-for-Chelsio-adapters/20180313-062514
> > :::::: branch date: 7 days ago
> > :::::: commit date: 7 days ago
> > 
> >  qp.c |    6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > +++ b/drivers/infiniband/hw/cxgb4/qp.c
> > @@ -2377,13 +2377,11 @@ static int alloc_srq_queue(struct c4iw_s
> >  	wq->rqt_abs_idx = (wq->rqt_hwaddr - rdev->lldi.vr->rq.start) >>
> >  		T4_RQT_ENTRY_SHIFT;
> > 
> > -	wq->queue = dma_alloc_coherent(&(rdev->lldi.pdev->dev),
> > -			wq->memsize, &(wq->dma_addr),
> > -			GFP_KERNEL);
> > +	wq->queue = dma_zalloc_coherent(&(rdev->lldi.pdev->dev), wq->memsize,
> > +					&(wq->dma_addr), GFP_KERNEL);
> >  	if (!wq->queue)
> >  		goto err_free_rqtpool;
> > 
> > -	memset(wq->queue, 0, wq->memsize);
> >  	pci_unmap_addr_set(wq, mapping, wq->dma_addr);
> > 
> >  	wq->bar2_va = c4iw_bar2_addrs(rdev, wq->qid, T4_BAR2_QTYPE_EGRESS,
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steve Wise March 19, 2018, 3:28 p.m. UTC | #3
On 3/19/2018 10:18 AM, Jason Gunthorpe wrote:
> On Mon, Mar 19, 2018 at 05:55:29PM +0530, Raju Rangoju wrote:
>> Thanks for pointing this out. I will fix it.
> When you say 'I will fix it', do you want me to apply this patch from
> Julia or do you plan something else? It looks fine to me.
>
> Jason

Hey Jason, Chelsio has opted to merge the cxgb4.ko changes only for srq 
and a few other new features via netdev this release cycle, and the 
iw_cxgb4 changes next release cycle.  See:

[1] https://www.spinics.net/lists/netdev/msg490021.html

So the original submission for srq that hits cxgb4.ko and iw_cxgb4.ko 
can be dropped.

Steve.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Raju Rangoju March 19, 2018, 4:21 p.m. UTC | #4
On Monday, March 03/19/18, 2018 at 09:18:54 -0600, Jason Gunthorpe wrote:
> On Mon, Mar 19, 2018 at 05:55:29PM +0530, Raju Rangoju wrote:
> > Thanks for pointing this out. I will fix it.
> 
> When you say 'I will fix it', do you want me to apply this patch from
> Julia or do you plan something else? It looks fine to me.

I meant to say, I will fix it in the next version of the patch that I spin for the next
release cycle. We choose to send cxgb4 changes this release cycle and iw_cxgb4
next release cycle.
> 
> Jason
> 
> > On Monday, March 03/19/18, 2018 at 12:11:55 +0100, Julia Lawall wrote:
> > > From: Fengguang Wu <fengguang.wu@intel.com>
> > > 
> > >  Use zeroing allocator rather than allocator followed by memset with 0
> > > 
> > > Generated by: scripts/coccinelle/api/alloc/zalloc-simple.cocci
> > > 
> > > CC: Raju Rangoju <rajur@chelsio.com>
> > > Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> > > Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
> > > 
> > > 
> > > url:
> > > https://github.com/0day-ci/linux/commits/Raju-Rangoju/rdma-cxgb4-Add-SRQ-support-for-Chelsio-adapters/20180313-062514
> > > :::::: branch date: 7 days ago
> > > :::::: commit date: 7 days ago
> > > 
> > >  qp.c |    6 ++----
> > >  1 file changed, 2 insertions(+), 4 deletions(-)
> > > 
> > > +++ b/drivers/infiniband/hw/cxgb4/qp.c
> > > @@ -2377,13 +2377,11 @@ static int alloc_srq_queue(struct c4iw_s
> > >  	wq->rqt_abs_idx = (wq->rqt_hwaddr - rdev->lldi.vr->rq.start) >>
> > >  		T4_RQT_ENTRY_SHIFT;
> > > 
> > > -	wq->queue = dma_alloc_coherent(&(rdev->lldi.pdev->dev),
> > > -			wq->memsize, &(wq->dma_addr),
> > > -			GFP_KERNEL);
> > > +	wq->queue = dma_zalloc_coherent(&(rdev->lldi.pdev->dev), wq->memsize,
> > > +					&(wq->dma_addr), GFP_KERNEL);
> > >  	if (!wq->queue)
> > >  		goto err_free_rqtpool;
> > > 
> > > -	memset(wq->queue, 0, wq->memsize);
> > >  	pci_unmap_addr_set(wq, mapping, wq->dma_addr);
> > > 
> > >  	wq->bar2_va = c4iw_bar2_addrs(rdev, wq->qid, T4_BAR2_QTYPE_EGRESS,
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -2377,13 +2377,11 @@  static int alloc_srq_queue(struct c4iw_s
 	wq->rqt_abs_idx = (wq->rqt_hwaddr - rdev->lldi.vr->rq.start) >>
 		T4_RQT_ENTRY_SHIFT;

-	wq->queue = dma_alloc_coherent(&(rdev->lldi.pdev->dev),
-			wq->memsize, &(wq->dma_addr),
-			GFP_KERNEL);
+	wq->queue = dma_zalloc_coherent(&(rdev->lldi.pdev->dev), wq->memsize,
+					&(wq->dma_addr), GFP_KERNEL);
 	if (!wq->queue)
 		goto err_free_rqtpool;

-	memset(wq->queue, 0, wq->memsize);
 	pci_unmap_addr_set(wq, mapping, wq->dma_addr);

 	wq->bar2_va = c4iw_bar2_addrs(rdev, wq->qid, T4_BAR2_QTYPE_EGRESS,