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: Andrew Morton <akpm@linux-foundation.org>
        u16 wcontrol;
        unsigned long flags;
 
-       if (!card)
-               BUG();
+       BUG_ON(!card);
 
        address = ALI_AC97_READ;
        if (card->revision == ALI_5451_V02) {
 
        data = ((u32) val) << 16;
 
-       if (!card)
-               BUG();
+       BUG_ON(!card);
 
        address = ALI_AC97_WRITE;
        mask = ALI_AC97_WRITE_ACTION | ALI_AC97_AUDIO_BUSY;
        struct trident_card *card = NULL;
 
        /* Added by Matt Wu */
-       if (!codec)
-               BUG();
+       BUG_ON(!codec);
 
        card = (struct trident_card *) codec->private_data;
 
        struct trident_card *card;
 
        /*  Added by Matt Wu */
-       if (!codec)
-               BUG();
+       BUG_ON(!codec);
 
        card = (struct trident_card *) codec->private_data;