Commit d6584f3a08055688b2344eb26379fb2f3147ce91

Authored by Julia Lawall
Committed by David S. Miller
1 parent 163e3cb7da

net/9p/trans_virtio.c: Use BUG_ON

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>

Showing 1 changed file with 1 additions and 2 deletions Side-by-side Diff

net/9p/trans_virtio.c
... ... @@ -183,8 +183,7 @@
183 183 sg_set_buf(&sg[index++], data, s);
184 184 count -= s;
185 185 data += s;
186   - if (index > limit)
187   - BUG();
  186 + BUG_ON(index > limit);
188 187 }
189 188  
190 189 return index-start;