Commit 21ac1f99 authored by Julia Lawall's avatar Julia Lawall Committed by Takashi Iwai

sound: 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: default avatarJulia Lawall <julia@diku.dk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 0ccb541c
...@@ -3076,8 +3076,7 @@ ali_ac97_get(struct trident_card *card, int secondary, u8 reg) ...@@ -3076,8 +3076,7 @@ ali_ac97_get(struct trident_card *card, int secondary, u8 reg)
u16 wcontrol; u16 wcontrol;
unsigned long flags; unsigned long flags;
if (!card) BUG_ON(!card);
BUG();
address = ALI_AC97_READ; address = ALI_AC97_READ;
if (card->revision == ALI_5451_V02) { if (card->revision == ALI_5451_V02) {
...@@ -3148,8 +3147,7 @@ ali_ac97_set(struct trident_card *card, int secondary, u8 reg, u16 val) ...@@ -3148,8 +3147,7 @@ ali_ac97_set(struct trident_card *card, int secondary, u8 reg, u16 val)
data = ((u32) val) << 16; data = ((u32) val) << 16;
if (!card) BUG_ON(!card);
BUG();
address = ALI_AC97_WRITE; address = ALI_AC97_WRITE;
mask = ALI_AC97_WRITE_ACTION | ALI_AC97_AUDIO_BUSY; mask = ALI_AC97_WRITE_ACTION | ALI_AC97_AUDIO_BUSY;
...@@ -3213,8 +3211,7 @@ ali_ac97_read(struct ac97_codec *codec, u8 reg) ...@@ -3213,8 +3211,7 @@ ali_ac97_read(struct ac97_codec *codec, u8 reg)
struct trident_card *card = NULL; struct trident_card *card = NULL;
/* Added by Matt Wu */ /* Added by Matt Wu */
if (!codec) BUG_ON(!codec);
BUG();
card = (struct trident_card *) codec->private_data; card = (struct trident_card *) codec->private_data;
...@@ -3240,8 +3237,7 @@ ali_ac97_write(struct ac97_codec *codec, u8 reg, u16 val) ...@@ -3240,8 +3237,7 @@ ali_ac97_write(struct ac97_codec *codec, u8 reg, u16 val)
struct trident_card *card; struct trident_card *card;
/* Added by Matt Wu */ /* Added by Matt Wu */
if (!codec) BUG_ON(!codec);
BUG();
card = (struct trident_card *) codec->private_data; card = (struct trident_card *) codec->private_data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment