2015-11-05 08:40:06

by Dan Carpenter

[permalink] [raw]
Subject: [patch 2/2] xprtrdma: checking for NULL instead of IS_ERR()

The rpcrdma_create_req() function returns error pointers or success. It
never returns NULL.

Fixes: f531a5dbc451 ('xprtrdma: Pre-allocate backward rpc_rqst and send/receive buffers')
Signed-off-by: Dan Carpenter <[email protected]>

diff --git a/net/sunrpc/xprtrdma/backchannel.c b/net/sunrpc/xprtrdma/backchannel.c
index 2dcb44f..97554ca 100644
--- a/net/sunrpc/xprtrdma/backchannel.c
+++ b/net/sunrpc/xprtrdma/backchannel.c
@@ -42,8 +42,8 @@ static int rpcrdma_bc_setup_rqst(struct rpcrdma_xprt *r_xprt,
size_t size;

req = rpcrdma_create_req(r_xprt);
- if (!req)
- return -ENOMEM;
+ if (IS_ERR(req))
+ return PTR_ERR(req);
req->rl_backchannel = true;

size = RPCRDMA_INLINE_WRITE_THRESHOLD(rqst);


2015-11-05 14:09:05

by Chuck Lever III

[permalink] [raw]
Subject: Re: [patch 2/2] xprtrdma: checking for NULL instead of IS_ERR()


> On Nov 5, 2015, at 3:39 AM, Dan Carpenter <[email protected]> wrote:
>
> The rpcrdma_create_req() function returns error pointers or success. It
> never returns NULL.
>
> Fixes: f531a5dbc451 ('xprtrdma: Pre-allocate backward rpc_rqst and send/receive buffers')
> Signed-off-by: Dan Carpenter <[email protected]>

Reviewed-by: Chuck Lever <[email protected]>


> diff --git a/net/sunrpc/xprtrdma/backchannel.c b/net/sunrpc/xprtrdma/backchannel.c
> index 2dcb44f..97554ca 100644
> --- a/net/sunrpc/xprtrdma/backchannel.c
> +++ b/net/sunrpc/xprtrdma/backchannel.c
> @@ -42,8 +42,8 @@ static int rpcrdma_bc_setup_rqst(struct rpcrdma_xprt *r_xprt,
> size_t size;
>
> req = rpcrdma_create_req(r_xprt);
> - if (!req)
> - return -ENOMEM;
> + if (IS_ERR(req))
> + return PTR_ERR(req);
> req->rl_backchannel = true;
>
> size = RPCRDMA_INLINE_WRITE_THRESHOLD(rqst);


Chuck Lever




2015-11-06 18:35:31

by Anna Schumaker

[permalink] [raw]
Subject: Re: [patch 2/2] xprtrdma: checking for NULL instead of IS_ERR()

On 11/05/2015 03:39 AM, Dan Carpenter wrote:
> The rpcrdma_create_req() function returns error pointers or success. It
> never returns NULL.
>
> Fixes: f531a5dbc451 ('xprtrdma: Pre-allocate backward rpc_rqst and send/receive buffers')
> Signed-off-by: Dan Carpenter <[email protected]>

Thanks, Dan! These patches don't look urgent, so if it's okay with you then I'll save them for 4.5.

Anna

>
> diff --git a/net/sunrpc/xprtrdma/backchannel.c b/net/sunrpc/xprtrdma/backchannel.c
> index 2dcb44f..97554ca 100644
> --- a/net/sunrpc/xprtrdma/backchannel.c
> +++ b/net/sunrpc/xprtrdma/backchannel.c
> @@ -42,8 +42,8 @@ static int rpcrdma_bc_setup_rqst(struct rpcrdma_xprt *r_xprt,
> size_t size;
>
> req = rpcrdma_create_req(r_xprt);
> - if (!req)
> - return -ENOMEM;
> + if (IS_ERR(req))
> + return PTR_ERR(req);
> req->rl_backchannel = true;
>
> size = RPCRDMA_INLINE_WRITE_THRESHOLD(rqst);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>


2015-11-06 20:05:11

by Dan Carpenter

[permalink] [raw]
Subject: Re: [patch 2/2] xprtrdma: checking for NULL instead of IS_ERR()

On Fri, Nov 06, 2015 at 01:34:50PM -0500, Anna Schumaker wrote:
> On 11/05/2015 03:39 AM, Dan Carpenter wrote:
> > The rpcrdma_create_req() function returns error pointers or success. It
> > never returns NULL.
> >
> > Fixes: f531a5dbc451 ('xprtrdma: Pre-allocate backward rpc_rqst and send/receive buffers')
> > Signed-off-by: Dan Carpenter <[email protected]>
>
> Thanks, Dan! These patches don't look urgent, so if it's okay with you then I'll save them for 4.5.

To be honest, I only ever care about linux-next and not released
versions. :P As long as it's in linux-next I'll be happy.

regards,
dan carpenter