[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <604b9282588697ead426564e3fe904809d1b7ae6.camel@kernel.org>
Date: Thu, 29 Aug 2024 09:11:34 -0400
From: Jeff Layton <jlayton@...nel.org>
To: Yan Zhen <yanzhen@...o.com>, chuck.lever@...cle.com, trondmy@...nel.org,
anna@...nel.org, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com
Cc: linux-nfs@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, opensource.kernel@...o.com, neilb@...e.de,
okorniev@...hat.com, tom@...pey.com, Dai.Ngo@...cle.com
Subject: Re: [PATCH net-next v1] sunrpc: Use ERR_CAST() to return
On Thu, 2024-08-29 at 21:04 +0800, Yan Zhen wrote:
> 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@...o.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;
>
Reviewed-by: Jeff Layton <jlayton@...nel.org>
Powered by blists - more mailing lists