]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
net/rxrpc: Use BUG_ON
authorJulia Lawall <julia@diku.dk>
Mon, 18 Feb 2008 02:42:03 +0000 (18:42 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 18 Feb 2008 02:42:03 +0000 (18:42 -0800)
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>
net/rxrpc/ar-accept.c
net/rxrpc/ar-ack.c

index 92a87fde8bfeb2b86f20a914275494e656636e1c..bdfb7741779441c3752176c5ad3ce585cc30cfc2 100644 (file)
@@ -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);
 
index 657ee69f213395599997c548f9b20959be4aac73..3ac1672e1070cc8c4b9a8870dfdb5f894fdcb3e7 100644 (file)
@@ -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;