diff options
author | Julien Brunel <brunel@diku.dk> | 2008-08-13 05:40:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-13 05:40:48 -0400 |
commit | 34093d055e09d1bb549efc11c8d448373437bbe4 (patch) | |
tree | c2197fb6b066087a8a4ae707e32317d33574768f /net | |
parent | 317900cb010f4aca0e3cb14a02d0ddcc44ddafa7 (diff) |
net/rxrpc: Use an IS_ERR test rather than a NULL test
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 <brunel@diku.dk>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/rxrpc/ar-accept.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/rxrpc/ar-accept.c b/net/rxrpc/ar-accept.c index bdfb77417794..77228f28fa36 100644 --- a/net/rxrpc/ar-accept.c +++ b/net/rxrpc/ar-accept.c | |||
@@ -100,7 +100,7 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local, | |||
100 | 100 | ||
101 | trans = rxrpc_get_transport(local, peer, GFP_NOIO); | 101 | trans = rxrpc_get_transport(local, peer, GFP_NOIO); |
102 | rxrpc_put_peer(peer); | 102 | rxrpc_put_peer(peer); |
103 | if (!trans) { | 103 | if (IS_ERR(trans)) { |
104 | _debug("no trans"); | 104 | _debug("no trans"); |
105 | ret = -EBUSY; | 105 | ret = -EBUSY; |
106 | goto error; | 106 | goto error; |