mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next v1] sunrpc: Use ERR_CAST() to return
@ 2024-08-29 13:04 Yan Zhen
  2024-08-29 13:11 ` Jeff Layton
  2024-08-29 14:53 ` Chuck Lever
  0 siblings, 2 replies; 6+ messages in thread
From: Yan Zhen @ 2024-08-29 13:04 UTC (permalink / raw)
  To: chuck.lever, jlayton, trondmy, anna, davem, edumazet, kuba, pabeni
  Cc: linux-nfs, netdev, linux-kernel, opensource.kernel, neilb,
	okorniev, tom, Dai.Ngo, Yan Zhen

Using ERR_CAST() is more reasonable and safer, When it is necessary
to convert the type of an error pointer and return it.

Signed-off-by: Yan Zhen <yanzhen@vivo.com>
---
 net/sunrpc/clnt.c                        | 2 +-
 net/sunrpc/xprtrdma/svc_rdma_transport.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 09f29a95f2bc..8ee87311b348 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -603,7 +603,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
 
 	xprt = xprt_create_transport(&xprtargs);
 	if (IS_ERR(xprt))
-		return (struct rpc_clnt *)xprt;
+		return ERR_CAST(xprt);
 
 	/*
 	 * By default, kernel RPC client connects from a reserved port.
diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
index 581cc5ed7c0c..c3fbf0779d4a 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
@@ -369,7 +369,7 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
 	listen_id = svc_rdma_create_listen_id(net, sa, cma_xprt);
 	if (IS_ERR(listen_id)) {
 		kfree(cma_xprt);
-		return (struct svc_xprt *)listen_id;
+		return ERR_CAST(listen_id);
 	}
 	cma_xprt->sc_cm_id = listen_id;
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread
* [PATCH net-next v1] sunrpc: Use ERR_CAST() to return
@ 2024-08-30  1:42 Yan Zhen
  2024-08-30  2:08 ` Trond Myklebust
  0 siblings, 1 reply; 6+ messages in thread
From: Yan Zhen @ 2024-08-30  1:42 UTC (permalink / raw)
  To: trondmy, anna, chuck.lever, jlayton, davem, edumazet, kuba, pabeni
  Cc: neilb, okorniev, Dai.Ngo, tom, linux-nfs, netdev, linux-kernel,
	opensource.kernel, Yan Zhen

Using ERR_CAST() is more reasonable and safer, When it is necessary
to convert the type of an error pointer and return it.

Signed-off-by: Yan Zhen <yanzhen@vivo.com>
---
 net/sunrpc/clnt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 09f29a95f2bc..8ee87311b348 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -603,7 +603,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
 
 	xprt = xprt_create_transport(&xprtargs);
 	if (IS_ERR(xprt))
-		return (struct rpc_clnt *)xprt;
+		return ERR_CAST(xprt);
 
 	/*
 	 * By default, kernel RPC client connects from a reserved port.
-- 
2.34.1


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

end of thread, other threads:[~2024-08-30 13:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-29 13:04 [PATCH net-next v1] sunrpc: Use ERR_CAST() to return Yan Zhen
2024-08-29 13:11 ` Jeff Layton
2024-08-29 14:53 ` Chuck Lever
2024-08-30  1:42 Yan Zhen
2024-08-30  2:08 ` Trond Myklebust
2024-08-30 13:39   ` Alexander Lobakin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®