Skip to contentSkip to conversation

xprtrdma: checking for NULL instead of IS_ERR()

PATCH In review Dan Carpenter 3 participants 4 messages Nov 5, 2015 – Nov 6, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

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')
net/sunrpc/xprtrdma/backchannel.c +2 -2
index 2dcb44f..97554ca 100644
@@ -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);
Reviewed-by on v1 2/2
#1 lore raw
Quoted 8 lines · Dan Carpenter

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')
Quoted 5 lines
net/sunrpc/xprtrdma/backchannel.c +0 -0
index 2dcb44f..97554ca 100644

net/sunrpc/xprtrdma/backchannel.c static int rpcrdma_bc_setup_rqst(struct rpcrdma_xprt *r_xprt, · line 49

Quoted 10 lines
net/sunrpc/xprtrdma/backchannel.c +2 -2
@@ -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

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to Dan Carpenter
Quoted 5 lines · Dan Carpenter

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')

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

Anna

Quoted 21 lines
net/sunrpc/xprtrdma/backchannel.c +2 -3
index 2dcb44f..97554ca 100644
@@ -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

#3 lore raw
Quoted 8 lines · Anna Schumaker
Quoted 5 lines · Dan Carpenter

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')

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