summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2008-03-04 15:07:24 -0800
committerTakashi Iwai <tiwai@suse.de>2008-04-24 12:00:22 +0200
commit21ac1f9934d33ea2ffa71d13fa2f6286127d3caf (patch)
tree931b6ad7de0da9e5b745f74c8431d5d2a11b30ae
parent0ccb541c96e6d40844d00ec88fae734568bdd0bd (diff)
downloadop-kernel-dev-21ac1f9934d33ea2ffa71d13fa2f6286127d3caf.zip
op-kernel-dev-21ac1f9934d33ea2ffa71d13fa2f6286127d3caf.tar.gz
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: Julia Lawall <julia@diku.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--sound/oss/trident.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sound/oss/trident.c b/sound/oss/trident.c
index d6af906..f43f91e 100644
--- a/sound/oss/trident.c
+++ b/sound/oss/trident.c
@@ -3076,8 +3076,7 @@ ali_ac97_get(struct trident_card *card, int secondary, u8 reg)
u16 wcontrol;
unsigned long flags;
- if (!card)
- BUG();
+ BUG_ON(!card);
address = ALI_AC97_READ;
if (card->revision == ALI_5451_V02) {
@@ -3148,8 +3147,7 @@ ali_ac97_set(struct trident_card *card, int secondary, u8 reg, u16 val)
data = ((u32) val) << 16;
- if (!card)
- BUG();
+ BUG_ON(!card);
address = ALI_AC97_WRITE;
mask = ALI_AC97_WRITE_ACTION | ALI_AC97_AUDIO_BUSY;
@@ -3213,8 +3211,7 @@ ali_ac97_read(struct ac97_codec *codec, u8 reg)
struct trident_card *card = NULL;
/* Added by Matt Wu */
- if (!codec)
- BUG();
+ BUG_ON(!codec);
card = (struct trident_card *) codec->private_data;
@@ -3240,8 +3237,7 @@ ali_ac97_write(struct ac97_codec *codec, u8 reg, u16 val)
struct trident_card *card;
/* Added by Matt Wu */
- if (!codec)
- BUG();
+ BUG_ON(!codec);
card = (struct trident_card *) codec->private_data;
OpenPOWER on IntegriCloud