From: Jeff Layton <jlayton@kernel.org>
To: Yan Zhen <yanzhen@vivo.com>,
chuck.lever@oracle.com, trondmy@kernel.org, anna@kernel.org,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com
Cc: linux-nfs@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, opensource.kernel@vivo.com,
neilb@suse.de, okorniev@redhat.com, tom@talpey.com,
Dai.Ngo@oracle.com
Subject: Re: [PATCH net-next v1] sunrpc: Use ERR_CAST() to return
Date: Thu, 29 Aug 2024 09:11:34 -0400 [thread overview]
Message-ID: <604b9282588697ead426564e3fe904809d1b7ae6.camel@kernel.org> (raw)
In-Reply-To: <20240829130434.3335629-1-yanzhen@vivo.com>
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@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;
>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2024-08-29 13:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-29 13:04 Yan Zhen
2024-08-29 13:11 ` Jeff Layton [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=604b9282588697ead426564e3fe904809d1b7ae6.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=anna@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=netdev@vger.kernel.org \
--cc=okorniev@redhat.com \
--cc=opensource.kernel@vivo.com \
--cc=pabeni@redhat.com \
--cc=tom@talpey.com \
--cc=trondmy@kernel.org \
--cc=yanzhen@vivo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®