diff options
author | Julien Brunel <brunel@diku.dk> | 2008-08-07 17:11:56 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-08-07 17:11:56 -0400 |
commit | cd55ef5a10d1a2ea09853bc5fa40aadaf9f80614 (patch) | |
tree | f26e6f9ba06171a5c404ba5220cba60ad53e2a34 /drivers/infiniband | |
parent | 6e86841d05f371b5b9b86ce76c02aaee83352298 (diff) |
IB/mad: Test ib_create_send_mad() return with IS_ERR(), not == NULL
In case of error, the function ib_create_send_mad() returns an ERR
pointer, but never returns a NULL pointer. So testing the return
value for error should be done with IS_ERR, not by comparing with
NULL.
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 = ib_create_send_mad(...)
<... 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: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/mad_rmpp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/core/mad_rmpp.c b/drivers/infiniband/core/mad_rmpp.c index d0ef7d61c037..3af2b84cd838 100644 --- a/drivers/infiniband/core/mad_rmpp.c +++ b/drivers/infiniband/core/mad_rmpp.c | |||
@@ -133,7 +133,7 @@ static void ack_recv(struct mad_rmpp_recv *rmpp_recv, | |||
133 | msg = ib_create_send_mad(&rmpp_recv->agent->agent, recv_wc->wc->src_qp, | 133 | msg = ib_create_send_mad(&rmpp_recv->agent->agent, recv_wc->wc->src_qp, |
134 | recv_wc->wc->pkey_index, 1, hdr_len, | 134 | recv_wc->wc->pkey_index, 1, hdr_len, |
135 | 0, GFP_KERNEL); | 135 | 0, GFP_KERNEL); |
136 | if (!msg) | 136 | if (IS_ERR(msg)) |
137 | return; | 137 | return; |
138 | 138 | ||
139 | format_ack(msg, (struct ib_rmpp_mad *) recv_wc->recv_buf.mad, rmpp_recv); | 139 | format_ack(msg, (struct ib_rmpp_mad *) recv_wc->recv_buf.mad, rmpp_recv); |