net/rxrpc: Use an IS_ERR test rather than a NULL test
Subsystems (4)
PATCH 1/1 net/rxrpc: Use an IS_ERR test rather than a NULL test
From: Julien Brunel <[email protected]>
In case of error, the function rxrpc_get_transport returns an ERR pointer, but never returns a NULL pointer. So after a call to this function, a NULL test should be replaced by an IS_ERR test.
A simplified version of the semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@correct_null_test@
expression x,E;
statement S1, S2;
@@
x = rxrpc_get_transport(...)
<... when != x = E
if (
(
- x@p2 != NULL
+ ! IS_ERR ( x )
|
- x@p2 = NULL
+ IS_ERR( x )
)
)
S1
else S2
...>
? x = E;
// </smpl>
--- net/rxrpc/ar-accept.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rxrpc/ar-accept.c +1 -1
@@ -100,7 +100,7 @@ static int rxrpc_accept_incoming_call(st trans =rxrpc_get_transport (local, peer,GFP_NOIO );rxrpc_put_peer (peer); -if (!trans) { +if (IS_ERR (trans)) {_debug ("no trans" ); ret = -EBUSY ; goto error;
From: Julien Brunel <[email protected]>
Date: Fri, 8 Aug 2008 13:55:21 +0200
Quoted 7 lines
In case of error, the function
rxrpc_get_transportreturns an ERR pointer, but never returns a NULL pointer. So after a call to this function, a NULL test should be replaced by anIS_ERRtest.A simplified version of the semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
...
Quoted 2 lines
Signed-off-by Julien Brunel <[email protected]>Signed-off-by Julia Lawall <[email protected]>
Applied, thank you.