diff mbox

svcrdma: delete double assignment

Message ID 20140728152938.GA3040@himangi-Dell (mailing list archive)
State New, archived
Headers show

Commit Message

HIMANGI SARAOGI July 28, 2014, 3:29 p.m. UTC
Delete successive assignments to the same location.

A simplified version of Coccinelle semantic match that finds this problem is as
follows:

// <smpl>
@@
expression i;
@@

*i = ...;
 i = ...;
// </smpl>

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
---
Should the assignment be the maximum of the 2 values?
 net/sunrpc/xprtrdma/svc_rdma_transport.c | 1 -
 1 file changed, 1 deletion(-)

Comments

David Miller July 29, 2014, 10:50 p.m. UTC | #1
From: Himangi Saraogi <himangi774@gmail.com>
Date: Mon, 28 Jul 2014 20:59:38 +0530

> Delete successive assignments to the same location.
> 
> A simplified version of Coccinelle semantic match that finds this problem is as
> follows:
> 
> // <smpl>
> @@
> expression i;
> @@
> 
> *i = ...;
>  i = ...;
> // </smpl>
> 
> Signed-off-by: Himangi Saraogi <himangi774@gmail.com>

I am not so sure about this change either.

> @@ -956,7 +956,6 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
>  			dprintk("svcrdma: failed to create QP, ret=%d\n", ret);
>  			goto errout;
>  		}
> -		newxprt->sc_max_sge = qp_attr.cap.max_send_sge;
>  		newxprt->sc_max_sge = qp_attr.cap.max_recv_sge;
>  		newxprt->sc_sq_depth = qp_attr.cap.max_send_wr;
>  		newxprt->sc_max_requests = qp_attr.cap.max_recv_wr;

->sc_max_sge is used to limit the number of segments used during sends,
currently in this code.  Grep for where it is used.

Therefore, if anything, the correct thing to do would be to retain the
first line rather than the second line.

Someone who actually works on this code and understands it should
really take a close look at this before anyone even thinks about
applying this patch.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" 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

diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
index 06a5d92..8976529 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
@@ -956,7 +956,6 @@  static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
 			dprintk("svcrdma: failed to create QP, ret=%d\n", ret);
 			goto errout;
 		}
-		newxprt->sc_max_sge = qp_attr.cap.max_send_sge;
 		newxprt->sc_max_sge = qp_attr.cap.max_recv_sge;
 		newxprt->sc_sq_depth = qp_attr.cap.max_send_wr;
 		newxprt->sc_max_requests = qp_attr.cap.max_recv_wr;