diff mbox series

[1/4] SUNRPC: Clean up unused variable in rpc_xprt_probe_trunked()

Message ID 20231201211549.126941-2-anna@kernel.org (mailing list archive)
State New, archived
Headers show
Series SUNRPC: Various RCU fixes | expand

Commit Message

Anna Schumaker Dec. 1, 2023, 9:15 p.m. UTC
From: Anna Schumaker <Anna.Schumaker@Netapp.com>

We don't use the rpc_xprt_switch anywhere in this function, so let's not
take an extra reference to in unnecessarily.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 net/sunrpc/clnt.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Jeff Layton Dec. 3, 2023, 12:18 p.m. UTC | #1
On Fri, 2023-12-01 at 16:15 -0500, Anna Schumaker wrote:
> From: Anna Schumaker <Anna.Schumaker@Netapp.com>
> 
> We don't use the rpc_xprt_switch anywhere in this function, so let's not
> take an extra reference to in unnecessarily.
> 
> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
> ---
>  net/sunrpc/clnt.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
> index daa9582ec861..4aa838543f79 100644
> --- a/net/sunrpc/clnt.c
> +++ b/net/sunrpc/clnt.c
> @@ -3116,7 +3116,6 @@ static int rpc_xprt_probe_trunked(struct rpc_clnt *clnt,
>  				  struct rpc_xprt *xprt,
>  				  struct rpc_add_xprt_test *data)
>  {
> -	struct rpc_xprt_switch *xps;
>  	struct rpc_xprt *main_xprt;
>  	int status = 0;
>  
> @@ -3124,7 +3123,6 @@ static int rpc_xprt_probe_trunked(struct rpc_clnt *clnt,
>  
>  	rcu_read_lock();
>  	main_xprt = xprt_get(rcu_dereference(clnt->cl_xprt));
> -	xps = xprt_switch_get(rcu_dereference(clnt->cl_xpi.xpi_xpswitch));
>  	status = rpc_cmp_addr_port((struct sockaddr *)&xprt->addr,
>  				   (struct sockaddr *)&main_xprt->addr);
>  	rcu_read_unlock();
> @@ -3135,7 +3133,6 @@ static int rpc_xprt_probe_trunked(struct rpc_clnt *clnt,
>  	status = rpc_clnt_add_xprt_helper(clnt, xprt, data);
>  out:
>  	xprt_put(xprt);
> -	xprt_switch_put(xps);
>  	return status;
>  }
>  

Seems right to me. If there is some hidden reason that we need to take
that reference here, then that needs to be documented in a comment.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
diff mbox series

Patch

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index daa9582ec861..4aa838543f79 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -3116,7 +3116,6 @@  static int rpc_xprt_probe_trunked(struct rpc_clnt *clnt,
 				  struct rpc_xprt *xprt,
 				  struct rpc_add_xprt_test *data)
 {
-	struct rpc_xprt_switch *xps;
 	struct rpc_xprt *main_xprt;
 	int status = 0;
 
@@ -3124,7 +3123,6 @@  static int rpc_xprt_probe_trunked(struct rpc_clnt *clnt,
 
 	rcu_read_lock();
 	main_xprt = xprt_get(rcu_dereference(clnt->cl_xprt));
-	xps = xprt_switch_get(rcu_dereference(clnt->cl_xpi.xpi_xpswitch));
 	status = rpc_cmp_addr_port((struct sockaddr *)&xprt->addr,
 				   (struct sockaddr *)&main_xprt->addr);
 	rcu_read_unlock();
@@ -3135,7 +3133,6 @@  static int rpc_xprt_probe_trunked(struct rpc_clnt *clnt,
 	status = rpc_clnt_add_xprt_helper(clnt, xprt, data);
 out:
 	xprt_put(xprt);
-	xprt_switch_put(xps);
 	return status;
 }