Skip to content

Commit

Permalink
net/rxrpc: Use an IS_ERR test rather than a NULL test
Browse files Browse the repository at this point in the history
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>

Signed-off-by: Julien Brunel <[email protected]>
Signed-off-by: Julia Lawall <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Julien Brunel authored and davem330 committed Aug 13, 2008
1 parent 317900c commit 34093d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/rxrpc/ar-accept.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,

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;
Expand Down

0 comments on commit 34093d0

Please sign in to comment.