aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-11-05 12:39:53 -0500
committerMark Brown <broonie@linaro.org>2013-11-06 05:26:25 -0500
commitbf90e895b51f61722681c1ee6e99113cbeba7d13 (patch)
tree479f050db33f027f66730a91c9265efe601c3053
parentf5b3a563943f415b99823be9918119f07337e328 (diff)
ASoC: wm2000: Use WARN_ON() instead of BUG_ON()
Use WARN_ON() and handle the error cases accordingly. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--sound/soc/codecs/wm2000.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c
index 7fefd766b582..8ae50274ea8f 100644
--- a/sound/soc/codecs/wm2000.c
+++ b/sound/soc/codecs/wm2000.c
@@ -137,7 +137,8 @@ static int wm2000_power_up(struct i2c_client *i2c, int analogue)
137 unsigned long rate; 137 unsigned long rate;
138 int ret; 138 int ret;
139 139
140 BUG_ON(wm2000->anc_mode != ANC_OFF); 140 if (WARN_ON(wm2000->anc_mode != ANC_OFF))
141 return -EINVAL;
141 142
142 dev_dbg(&i2c->dev, "Beginning power up\n"); 143 dev_dbg(&i2c->dev, "Beginning power up\n");
143 144
@@ -277,7 +278,8 @@ static int wm2000_enter_bypass(struct i2c_client *i2c, int analogue)
277{ 278{
278 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); 279 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev);
279 280
280 BUG_ON(wm2000->anc_mode != ANC_ACTIVE); 281 if (WARN_ON(wm2000->anc_mode != ANC_ACTIVE))
282 return -EINVAL;
281 283
282 if (analogue) { 284 if (analogue) {
283 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL, 285 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL,
@@ -315,7 +317,8 @@ static int wm2000_exit_bypass(struct i2c_client *i2c, int analogue)
315{ 317{
316 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); 318 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev);
317 319
318 BUG_ON(wm2000->anc_mode != ANC_BYPASS); 320 if (WARN_ON(wm2000->anc_mode != ANC_BYPASS))
321 return -EINVAL;
319 322
320 wm2000_write(i2c, WM2000_REG_SYS_CTL1, 0); 323 wm2000_write(i2c, WM2000_REG_SYS_CTL1, 0);
321 324
@@ -349,7 +352,8 @@ static int wm2000_enter_standby(struct i2c_client *i2c, int analogue)
349{ 352{
350 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); 353 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev);
351 354
352 BUG_ON(wm2000->anc_mode != ANC_ACTIVE); 355 if (WARN_ON(wm2000->anc_mode != ANC_ACTIVE))
356 return -EINVAL;
353 357
354 if (analogue) { 358 if (analogue) {
355 wm2000_write(i2c, WM2000_REG_ANA_VMID_PD_TIME, 248 / 4); 359 wm2000_write(i2c, WM2000_REG_ANA_VMID_PD_TIME, 248 / 4);
@@ -392,7 +396,8 @@ static int wm2000_exit_standby(struct i2c_client *i2c, int analogue)
392{ 396{
393 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); 397 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev);
394 398
395 BUG_ON(wm2000->anc_mode != ANC_STANDBY); 399 if (WARN_ON(wm2000->anc_mode != ANC_STANDBY))
400 return -EINVAL;
396 401
397 wm2000_write(i2c, WM2000_REG_SYS_CTL1, 0); 402 wm2000_write(i2c, WM2000_REG_SYS_CTL1, 0);
398 403