提交 bf90e895 编写于 作者: T Takashi Iwai 提交者: Mark Brown

ASoC: wm2000: Use WARN_ON() instead of BUG_ON()

Use WARN_ON() and handle the error cases accordingly.
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
Signed-off-by: NMark Brown <broonie@linaro.org>
上级 f5b3a563
......@@ -137,7 +137,8 @@ static int wm2000_power_up(struct i2c_client *i2c, int analogue)
unsigned long rate;
int ret;
BUG_ON(wm2000->anc_mode != ANC_OFF);
if (WARN_ON(wm2000->anc_mode != ANC_OFF))
return -EINVAL;
dev_dbg(&i2c->dev, "Beginning power up\n");
......@@ -277,7 +278,8 @@ static int wm2000_enter_bypass(struct i2c_client *i2c, int analogue)
{
struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev);
BUG_ON(wm2000->anc_mode != ANC_ACTIVE);
if (WARN_ON(wm2000->anc_mode != ANC_ACTIVE))
return -EINVAL;
if (analogue) {
wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL,
......@@ -315,7 +317,8 @@ static int wm2000_exit_bypass(struct i2c_client *i2c, int analogue)
{
struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev);
BUG_ON(wm2000->anc_mode != ANC_BYPASS);
if (WARN_ON(wm2000->anc_mode != ANC_BYPASS))
return -EINVAL;
wm2000_write(i2c, WM2000_REG_SYS_CTL1, 0);
......@@ -349,7 +352,8 @@ static int wm2000_enter_standby(struct i2c_client *i2c, int analogue)
{
struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev);
BUG_ON(wm2000->anc_mode != ANC_ACTIVE);
if (WARN_ON(wm2000->anc_mode != ANC_ACTIVE))
return -EINVAL;
if (analogue) {
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)
{
struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev);
BUG_ON(wm2000->anc_mode != ANC_STANDBY);
if (WARN_ON(wm2000->anc_mode != ANC_STANDBY))
return -EINVAL;
wm2000_write(i2c, WM2000_REG_SYS_CTL1, 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册