* [PATCH] net/rxrpc: Use an IS_ERR test rather than a NULL test
@ 2008-08-08 11:55 Julien Brunel
2008-08-13 9:41 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Julien Brunel @ 2008-08-08 11:55 UTC (permalink / raw)
To: davem, kuznet, pekkas, jmorris, yoshfuji, kaber, netdev,
linux-kernel, kernel
From: Julien Brunel <brunel@diku.dk>
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>
---
net/rxrpc/ar-accept.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -u -p a/net/rxrpc/ar-accept.c b/net/rxrpc/ar-accept.c
--- a/net/rxrpc/ar-accept.c
+++ b/net/rxrpc/ar-accept.c
@@ -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;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] net/rxrpc: Use an IS_ERR test rather than a NULL test
2008-08-08 11:55 [PATCH] net/rxrpc: Use an IS_ERR test rather than a NULL test Julien Brunel
@ 2008-08-13 9:41 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-08-13 9:41 UTC (permalink / raw)
To: brunel
Cc: kuznet, pekkas, jmorris, yoshfuji, kaber, netdev, linux-kernel,
kernel-janitors
From: Julien Brunel <brunel@diku.dk>
Date: Fri, 8 Aug 2008 13:55:21 +0200
> 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/)
...
> Signed-off-by: Julien Brunel <brunel@diku.dk>
> Signed-off-by: Julia Lawall <julia@diku.dk>
Applied, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-08-13 9:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-08 11:55 [PATCH] net/rxrpc: Use an IS_ERR test rather than a NULL test Julien Brunel
2008-08-13 9:41 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).