Skip to content

Commit

Permalink
net/rxrpc: Use BUG_ON
Browse files Browse the repository at this point in the history
if (...) BUG(); should be replaced with BUG_ON(...) when the test has no
side-effects to allow a definition of BUG_ON that drops the code completely.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@ disable unlikely @ expression E,f; @@

(
  if (<... f(...) ...>) { BUG(); }
|
- if (unlikely(E)) { BUG(); }
+ BUG_ON(E);
)

@@ expression E,f; @@

(
  if (<... f(...) ...>) { BUG(); }
|
- if (E) { BUG(); }
+ BUG_ON(E);
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Julia Lawall authored and David S. Miller committed Feb 18, 2008
1 parent 9ff5660 commit 163e3cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions net/rxrpc/ar-accept.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,
false);
spin_unlock(&call->lock);
notification = NULL;
if (ret < 0)
BUG();
BUG_ON(ret < 0);
}
spin_unlock(&call->conn->state_lock);

Expand Down
3 changes: 1 addition & 2 deletions net/rxrpc/ar-ack.c
Original file line number Diff line number Diff line change
Expand Up @@ -814,8 +814,7 @@ static int rxrpc_post_message(struct rxrpc_call *call, u32 mark, u32 error,
spin_lock_bh(&call->lock);
ret = rxrpc_queue_rcv_skb(call, skb, true, fatal);
spin_unlock_bh(&call->lock);
if (ret < 0)
BUG();
BUG_ON(ret < 0);
}

return 0;
Expand Down

0 comments on commit 163e3cb

Please sign in to comment.