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@xxxxxxxx> --- 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