diff options
author | Mark Brown <broonie@linaro.org> | 2013-11-08 05:43:41 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-11-08 05:43:41 -0500 |
commit | 108145a60675ebc0e42e7964ee6666096bbf86ce (patch) | |
tree | 19266ab0500d7bb188eb53634d484054d59473d2 /sound | |
parent | 022aa51e3fda0b3c6688defaa859961c11c36ec8 (diff) | |
parent | bf4edea863c435c302041cf8bb01c8b3ca729449 (diff) |
Merge remote-tracking branch 'asoc/topic/warn' into asoc-next
Diffstat (limited to 'sound')
28 files changed, 138 insertions, 92 deletions
diff --git a/sound/soc/blackfin/bf5xx-sport.c b/sound/soc/blackfin/bf5xx-sport.c index 695351241db8..9dfa1241ea66 100644 --- a/sound/soc/blackfin/bf5xx-sport.c +++ b/sound/soc/blackfin/bf5xx-sport.c | |||
@@ -179,8 +179,9 @@ static inline int sport_hook_rx_dummy(struct sport_device *sport) | |||
179 | struct dmasg *desc, temp_desc; | 179 | struct dmasg *desc, temp_desc; |
180 | unsigned long flags; | 180 | unsigned long flags; |
181 | 181 | ||
182 | BUG_ON(sport->dummy_rx_desc == NULL); | 182 | if (WARN_ON(!sport->dummy_rx_desc) || |
183 | BUG_ON(sport->curr_rx_desc == sport->dummy_rx_desc); | 183 | WARN_ON(sport->curr_rx_desc == sport->dummy_rx_desc)) |
184 | return -EINVAL; | ||
184 | 185 | ||
185 | /* Maybe the dummy buffer descriptor ring is damaged */ | 186 | /* Maybe the dummy buffer descriptor ring is damaged */ |
186 | sport->dummy_rx_desc->next_desc_addr = sport->dummy_rx_desc + 1; | 187 | sport->dummy_rx_desc->next_desc_addr = sport->dummy_rx_desc + 1; |
@@ -250,8 +251,9 @@ int sport_rx_start(struct sport_device *sport) | |||
250 | return -EBUSY; | 251 | return -EBUSY; |
251 | if (sport->tx_run) { | 252 | if (sport->tx_run) { |
252 | /* tx is running, rx is not running */ | 253 | /* tx is running, rx is not running */ |
253 | BUG_ON(sport->dma_rx_desc == NULL); | 254 | if (WARN_ON(!sport->dma_rx_desc) || |
254 | BUG_ON(sport->curr_rx_desc != sport->dummy_rx_desc); | 255 | WARN_ON(sport->curr_rx_desc != sport->dummy_rx_desc)) |
256 | return -EINVAL; | ||
255 | local_irq_save(flags); | 257 | local_irq_save(flags); |
256 | while ((get_dma_curr_desc_ptr(sport->dma_rx_chan) - | 258 | while ((get_dma_curr_desc_ptr(sport->dma_rx_chan) - |
257 | sizeof(struct dmasg)) != sport->dummy_rx_desc) | 259 | sizeof(struct dmasg)) != sport->dummy_rx_desc) |
@@ -298,8 +300,9 @@ static inline int sport_hook_tx_dummy(struct sport_device *sport) | |||
298 | struct dmasg *desc, temp_desc; | 300 | struct dmasg *desc, temp_desc; |
299 | unsigned long flags; | 301 | unsigned long flags; |
300 | 302 | ||
301 | BUG_ON(sport->dummy_tx_desc == NULL); | 303 | if (WARN_ON(!sport->dummy_tx_desc) || |
302 | BUG_ON(sport->curr_tx_desc == sport->dummy_tx_desc); | 304 | WARN_ON(sport->curr_tx_desc == sport->dummy_tx_desc)) |
305 | return -EINVAL; | ||
303 | 306 | ||
304 | sport->dummy_tx_desc->next_desc_addr = sport->dummy_tx_desc + 1; | 307 | sport->dummy_tx_desc->next_desc_addr = sport->dummy_tx_desc + 1; |
305 | 308 | ||
@@ -331,8 +334,9 @@ int sport_tx_start(struct sport_device *sport) | |||
331 | if (sport->tx_run) | 334 | if (sport->tx_run) |
332 | return -EBUSY; | 335 | return -EBUSY; |
333 | if (sport->rx_run) { | 336 | if (sport->rx_run) { |
334 | BUG_ON(sport->dma_tx_desc == NULL); | 337 | if (WARN_ON(!sport->dma_tx_desc) || |
335 | BUG_ON(sport->curr_tx_desc != sport->dummy_tx_desc); | 338 | WARN_ON(sport->curr_tx_desc != sport->dummy_tx_desc)) |
339 | return -EINVAL; | ||
336 | /* Hook the normal buffer descriptor */ | 340 | /* Hook the normal buffer descriptor */ |
337 | local_irq_save(flags); | 341 | local_irq_save(flags); |
338 | while ((get_dma_curr_desc_ptr(sport->dma_tx_chan) - | 342 | while ((get_dma_curr_desc_ptr(sport->dma_tx_chan) - |
@@ -767,7 +771,8 @@ static irqreturn_t err_handler(int irq, void *dev_id) | |||
767 | int sport_set_rx_callback(struct sport_device *sport, | 771 | int sport_set_rx_callback(struct sport_device *sport, |
768 | void (*rx_callback)(void *), void *rx_data) | 772 | void (*rx_callback)(void *), void *rx_data) |
769 | { | 773 | { |
770 | BUG_ON(rx_callback == NULL); | 774 | if (WARN_ON(!rx_callback)) |
775 | return -EINVAL; | ||
771 | sport->rx_callback = rx_callback; | 776 | sport->rx_callback = rx_callback; |
772 | sport->rx_data = rx_data; | 777 | sport->rx_data = rx_data; |
773 | 778 | ||
@@ -778,7 +783,8 @@ EXPORT_SYMBOL(sport_set_rx_callback); | |||
778 | int sport_set_tx_callback(struct sport_device *sport, | 783 | int sport_set_tx_callback(struct sport_device *sport, |
779 | void (*tx_callback)(void *), void *tx_data) | 784 | void (*tx_callback)(void *), void *tx_data) |
780 | { | 785 | { |
781 | BUG_ON(tx_callback == NULL); | 786 | if (WARN_ON(!tx_callback)) |
787 | return -EINVAL; | ||
782 | sport->tx_callback = tx_callback; | 788 | sport->tx_callback = tx_callback; |
783 | sport->tx_data = tx_data; | 789 | sport->tx_data = tx_data; |
784 | 790 | ||
@@ -789,7 +795,8 @@ EXPORT_SYMBOL(sport_set_tx_callback); | |||
789 | int sport_set_err_callback(struct sport_device *sport, | 795 | int sport_set_err_callback(struct sport_device *sport, |
790 | void (*err_callback)(void *), void *err_data) | 796 | void (*err_callback)(void *), void *err_data) |
791 | { | 797 | { |
792 | BUG_ON(err_callback == NULL); | 798 | if (WARN_ON(!err_callback)) |
799 | return -EINVAL; | ||
793 | sport->err_callback = err_callback; | 800 | sport->err_callback = err_callback; |
794 | sport->err_data = err_data; | 801 | sport->err_data = err_data; |
795 | 802 | ||
@@ -856,7 +863,8 @@ struct sport_device *sport_init(struct platform_device *pdev, | |||
856 | 863 | ||
857 | param.wdsize = wdsize; | 864 | param.wdsize = wdsize; |
858 | param.dummy_count = dummy_count; | 865 | param.dummy_count = dummy_count; |
859 | BUG_ON(param.wdsize == 0 || param.dummy_count == 0); | 866 | if (WARN_ON(param.wdsize == 0 || param.dummy_count == 0)) |
867 | return NULL; | ||
860 | 868 | ||
861 | ret = sport_config_pdev(pdev, ¶m); | 869 | ret = sport_config_pdev(pdev, ¶m); |
862 | if (ret) | 870 | if (ret) |
diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index 66ceee22fdad..53d7dab4e054 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c | |||
@@ -568,8 +568,9 @@ static void m98088_eq_band(struct snd_soc_codec *codec, unsigned int dai, | |||
568 | unsigned int eq_reg; | 568 | unsigned int eq_reg; |
569 | unsigned int i; | 569 | unsigned int i; |
570 | 570 | ||
571 | BUG_ON(band > 4); | 571 | if (WARN_ON(band > 4) || |
572 | BUG_ON(dai > 1); | 572 | WARN_ON(dai > 1)) |
573 | return; | ||
573 | 574 | ||
574 | /* Load the base register address */ | 575 | /* Load the base register address */ |
575 | eq_reg = dai ? M98088_REG_84_DAI2_EQ_BASE : M98088_REG_52_DAI1_EQ_BASE; | 576 | eq_reg = dai ? M98088_REG_84_DAI2_EQ_BASE : M98088_REG_52_DAI1_EQ_BASE; |
@@ -909,7 +910,8 @@ static int max98088_line_pga(struct snd_soc_dapm_widget *w, | |||
909 | struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); | 910 | struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); |
910 | u8 *state; | 911 | u8 *state; |
911 | 912 | ||
912 | BUG_ON(!((channel == 1) || (channel == 2))); | 913 | if (WARN_ON(!(channel == 1 || channel == 2))) |
914 | return -EINVAL; | ||
913 | 915 | ||
914 | switch (line) { | 916 | switch (line) { |
915 | case LINE_INA: | 917 | case LINE_INA: |
diff --git a/sound/soc/codecs/max98095.c b/sound/soc/codecs/max98095.c index 8fb072455802..67244315c721 100644 --- a/sound/soc/codecs/max98095.c +++ b/sound/soc/codecs/max98095.c | |||
@@ -516,8 +516,9 @@ static void m98095_eq_band(struct snd_soc_codec *codec, unsigned int dai, | |||
516 | unsigned int eq_reg; | 516 | unsigned int eq_reg; |
517 | unsigned int i; | 517 | unsigned int i; |
518 | 518 | ||
519 | BUG_ON(band > 4); | 519 | if (WARN_ON(band > 4) || |
520 | BUG_ON(dai > 1); | 520 | WARN_ON(dai > 1)) |
521 | return; | ||
521 | 522 | ||
522 | /* Load the base register address */ | 523 | /* Load the base register address */ |
523 | eq_reg = dai ? M98095_142_DAI2_EQ_BASE : M98095_110_DAI1_EQ_BASE; | 524 | eq_reg = dai ? M98095_142_DAI2_EQ_BASE : M98095_110_DAI1_EQ_BASE; |
@@ -541,8 +542,9 @@ static void m98095_biquad_band(struct snd_soc_codec *codec, unsigned int dai, | |||
541 | unsigned int bq_reg; | 542 | unsigned int bq_reg; |
542 | unsigned int i; | 543 | unsigned int i; |
543 | 544 | ||
544 | BUG_ON(band > 1); | 545 | if (WARN_ON(band > 1) || |
545 | BUG_ON(dai > 1); | 546 | WARN_ON(dai > 1)) |
547 | return; | ||
546 | 548 | ||
547 | /* Load the base register address */ | 549 | /* Load the base register address */ |
548 | bq_reg = dai ? M98095_17E_DAI2_BQ_BASE : M98095_174_DAI1_BQ_BASE; | 550 | bq_reg = dai ? M98095_17E_DAI2_BQ_BASE : M98095_174_DAI1_BQ_BASE; |
@@ -890,7 +892,8 @@ static int max98095_line_pga(struct snd_soc_dapm_widget *w, | |||
890 | struct max98095_priv *max98095 = snd_soc_codec_get_drvdata(codec); | 892 | struct max98095_priv *max98095 = snd_soc_codec_get_drvdata(codec); |
891 | u8 *state; | 893 | u8 *state; |
892 | 894 | ||
893 | BUG_ON(!((channel == 1) || (channel == 2))); | 895 | if (WARN_ON(!(channel == 1 || channel == 2))) |
896 | return -EINVAL; | ||
894 | 897 | ||
895 | state = &max98095->lin_state; | 898 | state = &max98095->lin_state; |
896 | 899 | ||
@@ -1740,7 +1743,8 @@ static int max98095_put_eq_enum(struct snd_kcontrol *kcontrol, | |||
1740 | int fs, best, best_val, i; | 1743 | int fs, best, best_val, i; |
1741 | int regmask, regsave; | 1744 | int regmask, regsave; |
1742 | 1745 | ||
1743 | BUG_ON(channel > 1); | 1746 | if (WARN_ON(channel > 1)) |
1747 | return -EINVAL; | ||
1744 | 1748 | ||
1745 | if (!pdata || !max98095->eq_textcnt) | 1749 | if (!pdata || !max98095->eq_textcnt) |
1746 | return 0; | 1750 | return 0; |
diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c index 998555f2a8aa..b27c396037d4 100644 --- a/sound/soc/codecs/tpa6130a2.c +++ b/sound/soc/codecs/tpa6130a2.c | |||
@@ -56,7 +56,8 @@ static int tpa6130a2_i2c_read(int reg) | |||
56 | struct tpa6130a2_data *data; | 56 | struct tpa6130a2_data *data; |
57 | int val; | 57 | int val; |
58 | 58 | ||
59 | BUG_ON(tpa6130a2_client == NULL); | 59 | if (WARN_ON(!tpa6130a2_client)) |
60 | return -EINVAL; | ||
60 | data = i2c_get_clientdata(tpa6130a2_client); | 61 | data = i2c_get_clientdata(tpa6130a2_client); |
61 | 62 | ||
62 | /* If powered off, return the cached value */ | 63 | /* If powered off, return the cached value */ |
@@ -78,7 +79,8 @@ static int tpa6130a2_i2c_write(int reg, u8 value) | |||
78 | struct tpa6130a2_data *data; | 79 | struct tpa6130a2_data *data; |
79 | int val = 0; | 80 | int val = 0; |
80 | 81 | ||
81 | BUG_ON(tpa6130a2_client == NULL); | 82 | if (WARN_ON(!tpa6130a2_client)) |
83 | return -EINVAL; | ||
82 | data = i2c_get_clientdata(tpa6130a2_client); | 84 | data = i2c_get_clientdata(tpa6130a2_client); |
83 | 85 | ||
84 | if (data->power_state) { | 86 | if (data->power_state) { |
@@ -99,7 +101,8 @@ static u8 tpa6130a2_read(int reg) | |||
99 | { | 101 | { |
100 | struct tpa6130a2_data *data; | 102 | struct tpa6130a2_data *data; |
101 | 103 | ||
102 | BUG_ON(tpa6130a2_client == NULL); | 104 | if (WARN_ON(!tpa6130a2_client)) |
105 | return 0; | ||
103 | data = i2c_get_clientdata(tpa6130a2_client); | 106 | data = i2c_get_clientdata(tpa6130a2_client); |
104 | 107 | ||
105 | return data->regs[reg]; | 108 | return data->regs[reg]; |
@@ -110,7 +113,8 @@ static int tpa6130a2_initialize(void) | |||
110 | struct tpa6130a2_data *data; | 113 | struct tpa6130a2_data *data; |
111 | int i, ret = 0; | 114 | int i, ret = 0; |
112 | 115 | ||
113 | BUG_ON(tpa6130a2_client == NULL); | 116 | if (WARN_ON(!tpa6130a2_client)) |
117 | return -EINVAL; | ||
114 | data = i2c_get_clientdata(tpa6130a2_client); | 118 | data = i2c_get_clientdata(tpa6130a2_client); |
115 | 119 | ||
116 | for (i = 1; i < TPA6130A2_REG_VERSION; i++) { | 120 | for (i = 1; i < TPA6130A2_REG_VERSION; i++) { |
@@ -128,7 +132,8 @@ static int tpa6130a2_power(u8 power) | |||
128 | u8 val; | 132 | u8 val; |
129 | int ret = 0; | 133 | int ret = 0; |
130 | 134 | ||
131 | BUG_ON(tpa6130a2_client == NULL); | 135 | if (WARN_ON(!tpa6130a2_client)) |
136 | return -EINVAL; | ||
132 | data = i2c_get_clientdata(tpa6130a2_client); | 137 | data = i2c_get_clientdata(tpa6130a2_client); |
133 | 138 | ||
134 | mutex_lock(&data->mutex); | 139 | mutex_lock(&data->mutex); |
@@ -194,7 +199,8 @@ static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol, | |||
194 | unsigned int mask = (1 << fls(max)) - 1; | 199 | unsigned int mask = (1 << fls(max)) - 1; |
195 | unsigned int invert = mc->invert; | 200 | unsigned int invert = mc->invert; |
196 | 201 | ||
197 | BUG_ON(tpa6130a2_client == NULL); | 202 | if (WARN_ON(!tpa6130a2_client)) |
203 | return -EINVAL; | ||
198 | data = i2c_get_clientdata(tpa6130a2_client); | 204 | data = i2c_get_clientdata(tpa6130a2_client); |
199 | 205 | ||
200 | mutex_lock(&data->mutex); | 206 | mutex_lock(&data->mutex); |
@@ -224,7 +230,8 @@ static int tpa6130a2_put_volsw(struct snd_kcontrol *kcontrol, | |||
224 | unsigned int val = (ucontrol->value.integer.value[0] & mask); | 230 | unsigned int val = (ucontrol->value.integer.value[0] & mask); |
225 | unsigned int val_reg; | 231 | unsigned int val_reg; |
226 | 232 | ||
227 | BUG_ON(tpa6130a2_client == NULL); | 233 | if (WARN_ON(!tpa6130a2_client)) |
234 | return -EINVAL; | ||
228 | data = i2c_get_clientdata(tpa6130a2_client); | 235 | data = i2c_get_clientdata(tpa6130a2_client); |
229 | 236 | ||
230 | if (invert) | 237 | if (invert) |
diff --git a/sound/soc/codecs/wm0010.c b/sound/soc/codecs/wm0010.c index d5ebcb00019b..aea916431227 100644 --- a/sound/soc/codecs/wm0010.c +++ b/sound/soc/codecs/wm0010.c | |||
@@ -372,7 +372,8 @@ static int wm0010_firmware_load(const char *name, struct snd_soc_codec *codec) | |||
372 | offset = 0; | 372 | offset = 0; |
373 | dsp = inforec->dsp_target; | 373 | dsp = inforec->dsp_target; |
374 | wm0010->boot_failed = false; | 374 | wm0010->boot_failed = false; |
375 | BUG_ON(!list_empty(&xfer_list)); | 375 | if (WARN_ON(!list_empty(&xfer_list))) |
376 | return -EINVAL; | ||
376 | init_completion(&done); | 377 | init_completion(&done); |
377 | 378 | ||
378 | /* First record should be INFO */ | 379 | /* First record should be INFO */ |
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 | ||
diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c index ac1745d030d6..4cf91deabc02 100644 --- a/sound/soc/codecs/wm5100.c +++ b/sound/soc/codecs/wm5100.c | |||
@@ -1972,7 +1972,8 @@ static void wm5100_set_detect_mode(struct wm5100_priv *wm5100, int the_mode) | |||
1972 | { | 1972 | { |
1973 | struct wm5100_jack_mode *mode = &wm5100->pdata.jack_modes[the_mode]; | 1973 | struct wm5100_jack_mode *mode = &wm5100->pdata.jack_modes[the_mode]; |
1974 | 1974 | ||
1975 | BUG_ON(the_mode >= ARRAY_SIZE(wm5100->pdata.jack_modes)); | 1975 | if (WARN_ON(the_mode >= ARRAY_SIZE(wm5100->pdata.jack_modes))) |
1976 | return; | ||
1976 | 1977 | ||
1977 | gpio_set_value_cansleep(wm5100->pdata.hp_pol, mode->hp_pol); | 1978 | gpio_set_value_cansleep(wm5100->pdata.hp_pol, mode->hp_pol); |
1978 | regmap_update_bits(wm5100->regmap, WM5100_ACCESSORY_DETECT_MODE_1, | 1979 | regmap_update_bits(wm5100->regmap, WM5100_ACCESSORY_DETECT_MODE_1, |
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index af1318ddb062..a183dcf3d5c1 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c | |||
@@ -274,7 +274,7 @@ static int pga_event(struct snd_soc_dapm_widget *w, | |||
274 | break; | 274 | break; |
275 | 275 | ||
276 | default: | 276 | default: |
277 | BUG(); | 277 | WARN(1, "Invalid shift %d\n", w->shift); |
278 | return -1; | 278 | return -1; |
279 | } | 279 | } |
280 | 280 | ||
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index 5e9c40fa7eb2..08a414b57b1e 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c | |||
@@ -736,7 +736,7 @@ static int wm8580_set_sysclk(struct snd_soc_dai *dai, int clk_id, | |||
736 | break; | 736 | break; |
737 | 737 | ||
738 | default: | 738 | default: |
739 | BUG_ON("Unknown DAI driver ID\n"); | 739 | WARN(1, "Unknown DAI driver ID\n"); |
740 | return -EINVAL; | 740 | return -EINVAL; |
741 | } | 741 | } |
742 | 742 | ||
diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c index f31017ed1381..942d58e455f3 100644 --- a/sound/soc/codecs/wm8776.c +++ b/sound/soc/codecs/wm8776.c | |||
@@ -325,7 +325,8 @@ static int wm8776_set_sysclk(struct snd_soc_dai *dai, | |||
325 | struct snd_soc_codec *codec = dai->codec; | 325 | struct snd_soc_codec *codec = dai->codec; |
326 | struct wm8776_priv *wm8776 = snd_soc_codec_get_drvdata(codec); | 326 | struct wm8776_priv *wm8776 = snd_soc_codec_get_drvdata(codec); |
327 | 327 | ||
328 | BUG_ON(dai->driver->id >= ARRAY_SIZE(wm8776->sysclk)); | 328 | if (WARN_ON(dai->driver->id >= ARRAY_SIZE(wm8776->sysclk))) |
329 | return -EINVAL; | ||
329 | 330 | ||
330 | wm8776->sysclk[dai->driver->id] = freq; | 331 | wm8776->sysclk[dai->driver->id] = freq; |
331 | 332 | ||
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c index 7c8257c5a17b..734209e252c3 100644 --- a/sound/soc/codecs/wm8900.c +++ b/sound/soc/codecs/wm8900.c | |||
@@ -279,7 +279,8 @@ static int wm8900_hp_event(struct snd_soc_dapm_widget *w, | |||
279 | break; | 279 | break; |
280 | 280 | ||
281 | default: | 281 | default: |
282 | BUG(); | 282 | WARN(1, "Invalid event %d\n", event); |
283 | break; | ||
283 | } | 284 | } |
284 | 285 | ||
285 | return 0; | 286 | return 0; |
@@ -691,7 +692,8 @@ static int fll_factors(struct _fll_div *fll_div, unsigned int Fref, | |||
691 | unsigned int K, Ndiv, Nmod, target; | 692 | unsigned int K, Ndiv, Nmod, target; |
692 | unsigned int div; | 693 | unsigned int div; |
693 | 694 | ||
694 | BUG_ON(!Fout); | 695 | if (WARN_ON(!Fout)) |
696 | return -EINVAL; | ||
695 | 697 | ||
696 | /* The FLL must run at 90-100MHz which is then scaled down to | 698 | /* The FLL must run at 90-100MHz which is then scaled down to |
697 | * the output value by FLLCLK_DIV. */ | 699 | * the output value by FLLCLK_DIV. */ |
@@ -742,8 +744,9 @@ static int fll_factors(struct _fll_div *fll_div, unsigned int Fref, | |||
742 | /* Move down to proper range now rounding is done */ | 744 | /* Move down to proper range now rounding is done */ |
743 | fll_div->k = K / 10; | 745 | fll_div->k = K / 10; |
744 | 746 | ||
745 | BUG_ON(target != Fout * (fll_div->fllclk_div << 2)); | 747 | if (WARN_ON(target != Fout * (fll_div->fllclk_div << 2)) || |
746 | BUG_ON(!K && target != Fref * fll_div->fll_ratio * fll_div->n); | 748 | WARN_ON(!K && target != Fref * fll_div->fll_ratio * fll_div->n)) |
749 | return -EINVAL; | ||
747 | 750 | ||
748 | return 0; | 751 | return 0; |
749 | } | 752 | } |
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index 4dfa8dceeabf..3938fb1c203e 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c | |||
@@ -658,7 +658,8 @@ SOC_SINGLE_TLV("EQ5 Volume", WM8904_EQ6, 0, 24, 0, eq_tlv), | |||
658 | static int cp_event(struct snd_soc_dapm_widget *w, | 658 | static int cp_event(struct snd_soc_dapm_widget *w, |
659 | struct snd_kcontrol *kcontrol, int event) | 659 | struct snd_kcontrol *kcontrol, int event) |
660 | { | 660 | { |
661 | BUG_ON(event != SND_SOC_DAPM_POST_PMU); | 661 | if (WARN_ON(event != SND_SOC_DAPM_POST_PMU)) |
662 | return -EINVAL; | ||
662 | 663 | ||
663 | /* Maximum startup time */ | 664 | /* Maximum startup time */ |
664 | udelay(500); | 665 | udelay(500); |
@@ -740,7 +741,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, | |||
740 | dcs_r = 3; | 741 | dcs_r = 3; |
741 | break; | 742 | break; |
742 | default: | 743 | default: |
743 | BUG(); | 744 | WARN(1, "Invalid reg %d\n", reg); |
744 | return -EINVAL; | 745 | return -EINVAL; |
745 | } | 746 | } |
746 | 747 | ||
diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c index b0710d817a65..b7488f190d2b 100644 --- a/sound/soc/codecs/wm8958-dsp2.c +++ b/sound/soc/codecs/wm8958-dsp2.c | |||
@@ -348,7 +348,7 @@ static void wm8958_dsp_apply(struct snd_soc_codec *codec, int path, int start) | |||
348 | aif = 1; | 348 | aif = 1; |
349 | break; | 349 | break; |
350 | default: | 350 | default: |
351 | BUG(); | 351 | WARN(1, "Invalid path %d\n", path); |
352 | return; | 352 | return; |
353 | } | 353 | } |
354 | 354 | ||
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 11d80f3b6137..22e42e788649 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c | |||
@@ -1845,7 +1845,7 @@ static int cp_event(struct snd_soc_dapm_widget *w, | |||
1845 | break; | 1845 | break; |
1846 | 1846 | ||
1847 | default: | 1847 | default: |
1848 | BUG(); | 1848 | WARN(1, "Invalid event %d\n", event); |
1849 | return -EINVAL; | 1849 | return -EINVAL; |
1850 | } | 1850 | } |
1851 | 1851 | ||
@@ -1937,7 +1937,7 @@ static int hp_event(struct snd_soc_dapm_widget *w, | |||
1937 | break; | 1937 | break; |
1938 | 1938 | ||
1939 | default: | 1939 | default: |
1940 | BUG(); | 1940 | WARN(1, "Invalid event %d\n", event); |
1941 | return -EINVAL; | 1941 | return -EINVAL; |
1942 | 1942 | ||
1943 | } | 1943 | } |
@@ -1966,7 +1966,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, | |||
1966 | reg = WM8962_SPKOUTL_VOLUME; | 1966 | reg = WM8962_SPKOUTL_VOLUME; |
1967 | break; | 1967 | break; |
1968 | default: | 1968 | default: |
1969 | BUG(); | 1969 | WARN(1, "Invalid shift %d\n", w->shift); |
1970 | return -EINVAL; | 1970 | return -EINVAL; |
1971 | } | 1971 | } |
1972 | 1972 | ||
@@ -1974,7 +1974,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, | |||
1974 | case SND_SOC_DAPM_POST_PMU: | 1974 | case SND_SOC_DAPM_POST_PMU: |
1975 | return snd_soc_write(codec, reg, snd_soc_read(codec, reg)); | 1975 | return snd_soc_write(codec, reg, snd_soc_read(codec, reg)); |
1976 | default: | 1976 | default: |
1977 | BUG(); | 1977 | WARN(1, "Invalid event %d\n", event); |
1978 | return -EINVAL; | 1978 | return -EINVAL; |
1979 | } | 1979 | } |
1980 | } | 1980 | } |
@@ -1997,7 +1997,7 @@ static int dsp2_event(struct snd_soc_dapm_widget *w, | |||
1997 | break; | 1997 | break; |
1998 | 1998 | ||
1999 | default: | 1999 | default: |
2000 | BUG(); | 2000 | WARN(1, "Invalid event %d\n", event); |
2001 | return -EINVAL; | 2001 | return -EINVAL; |
2002 | } | 2002 | } |
2003 | 2003 | ||
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index 46fe83d2b224..d666de03704a 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c | |||
@@ -608,7 +608,7 @@ static int bg_event(struct snd_soc_dapm_widget *w, | |||
608 | wm8996_bg_disable(codec); | 608 | wm8996_bg_disable(codec); |
609 | break; | 609 | break; |
610 | default: | 610 | default: |
611 | BUG(); | 611 | WARN(1, "Invalid event %d\n", event); |
612 | ret = -EINVAL; | 612 | ret = -EINVAL; |
613 | } | 613 | } |
614 | 614 | ||
@@ -625,7 +625,7 @@ static int cp_event(struct snd_soc_dapm_widget *w, | |||
625 | msleep(5); | 625 | msleep(5); |
626 | break; | 626 | break; |
627 | default: | 627 | default: |
628 | BUG(); | 628 | WARN(1, "Invalid event %d\n", event); |
629 | ret = -EINVAL; | 629 | ret = -EINVAL; |
630 | } | 630 | } |
631 | 631 | ||
@@ -646,7 +646,7 @@ static int rmv_short_event(struct snd_soc_dapm_widget *w, | |||
646 | wm8996->hpout_pending |= w->shift; | 646 | wm8996->hpout_pending |= w->shift; |
647 | break; | 647 | break; |
648 | default: | 648 | default: |
649 | BUG(); | 649 | WARN(1, "Invalid event %d\n", event); |
650 | return -EINVAL; | 650 | return -EINVAL; |
651 | } | 651 | } |
652 | 652 | ||
@@ -767,7 +767,7 @@ static int dcs_start(struct snd_soc_dapm_widget *w, | |||
767 | wm8996->dcs_pending |= 1 << w->shift; | 767 | wm8996->dcs_pending |= 1 << w->shift; |
768 | break; | 768 | break; |
769 | default: | 769 | default: |
770 | BUG(); | 770 | WARN(1, "Invalid event %d\n", event); |
771 | return -EINVAL; | 771 | return -EINVAL; |
772 | } | 772 | } |
773 | 773 | ||
@@ -1656,7 +1656,7 @@ static int wm8996_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) | |||
1656 | lrclk_rx_reg = WM8996_AIF2_RX_LRCLK_2; | 1656 | lrclk_rx_reg = WM8996_AIF2_RX_LRCLK_2; |
1657 | break; | 1657 | break; |
1658 | default: | 1658 | default: |
1659 | BUG(); | 1659 | WARN(1, "Invalid dai id %d\n", dai->id); |
1660 | return -EINVAL; | 1660 | return -EINVAL; |
1661 | } | 1661 | } |
1662 | 1662 | ||
@@ -1768,7 +1768,7 @@ static int wm8996_hw_params(struct snd_pcm_substream *substream, | |||
1768 | dsp_shift = WM8996_DSP2_DIV_SHIFT; | 1768 | dsp_shift = WM8996_DSP2_DIV_SHIFT; |
1769 | break; | 1769 | break; |
1770 | default: | 1770 | default: |
1771 | BUG(); | 1771 | WARN(1, "Invalid dai id %d\n", dai->id); |
1772 | return -EINVAL; | 1772 | return -EINVAL; |
1773 | } | 1773 | } |
1774 | 1774 | ||
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index a53e175c015a..acea8927905b 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c | |||
@@ -221,7 +221,8 @@ static int wm9713_voice_shutdown(struct snd_soc_dapm_widget *w, | |||
221 | struct snd_soc_codec *codec = w->codec; | 221 | struct snd_soc_codec *codec = w->codec; |
222 | u16 status, rate; | 222 | u16 status, rate; |
223 | 223 | ||
224 | BUG_ON(event != SND_SOC_DAPM_PRE_PMD); | 224 | if (WARN_ON(event != SND_SOC_DAPM_PRE_PMD)) |
225 | return -EINVAL; | ||
225 | 226 | ||
226 | /* Gracefully shut down the voice interface. */ | 227 | /* Gracefully shut down the voice interface. */ |
227 | status = ac97_read(codec, AC97_EXTENDED_MID) | 0x1000; | 228 | status = ac97_read(codec, AC97_EXTENDED_MID) | 0x1000; |
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index df95e5a83889..46ec0e9744d4 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c | |||
@@ -341,6 +341,8 @@ static struct wm_adsp_region const *wm_adsp_find_region(struct wm_adsp *dsp, | |||
341 | static unsigned int wm_adsp_region_to_reg(struct wm_adsp_region const *region, | 341 | static unsigned int wm_adsp_region_to_reg(struct wm_adsp_region const *region, |
342 | unsigned int offset) | 342 | unsigned int offset) |
343 | { | 343 | { |
344 | if (WARN_ON(!region)) | ||
345 | return offset; | ||
344 | switch (region->type) { | 346 | switch (region->type) { |
345 | case WMFW_ADSP1_PM: | 347 | case WMFW_ADSP1_PM: |
346 | return region->base + (offset * 3); | 348 | return region->base + (offset * 3); |
@@ -353,7 +355,7 @@ static unsigned int wm_adsp_region_to_reg(struct wm_adsp_region const *region, | |||
353 | case WMFW_ADSP1_ZM: | 355 | case WMFW_ADSP1_ZM: |
354 | return region->base + (offset * 2); | 356 | return region->base + (offset * 2); |
355 | default: | 357 | default: |
356 | WARN_ON(NULL != "Unknown memory region type"); | 358 | WARN(1, "Unknown memory region type"); |
357 | return offset; | 359 | return offset; |
358 | } | 360 | } |
359 | } | 361 | } |
@@ -605,7 +607,7 @@ static int wm_adsp_load(struct wm_adsp *dsp) | |||
605 | break; | 607 | break; |
606 | 608 | ||
607 | default: | 609 | default: |
608 | BUG_ON(NULL == "Unknown DSP type"); | 610 | WARN(1, "Unknown DSP type"); |
609 | goto out_fw; | 611 | goto out_fw; |
610 | } | 612 | } |
611 | 613 | ||
@@ -645,27 +647,22 @@ static int wm_adsp_load(struct wm_adsp *dsp) | |||
645 | reg = offset; | 647 | reg = offset; |
646 | break; | 648 | break; |
647 | case WMFW_ADSP1_PM: | 649 | case WMFW_ADSP1_PM: |
648 | BUG_ON(!mem); | ||
649 | region_name = "PM"; | 650 | region_name = "PM"; |
650 | reg = wm_adsp_region_to_reg(mem, offset); | 651 | reg = wm_adsp_region_to_reg(mem, offset); |
651 | break; | 652 | break; |
652 | case WMFW_ADSP1_DM: | 653 | case WMFW_ADSP1_DM: |
653 | BUG_ON(!mem); | ||
654 | region_name = "DM"; | 654 | region_name = "DM"; |
655 | reg = wm_adsp_region_to_reg(mem, offset); | 655 | reg = wm_adsp_region_to_reg(mem, offset); |
656 | break; | 656 | break; |
657 | case WMFW_ADSP2_XM: | 657 | case WMFW_ADSP2_XM: |
658 | BUG_ON(!mem); | ||
659 | region_name = "XM"; | 658 | region_name = "XM"; |
660 | reg = wm_adsp_region_to_reg(mem, offset); | 659 | reg = wm_adsp_region_to_reg(mem, offset); |
661 | break; | 660 | break; |
662 | case WMFW_ADSP2_YM: | 661 | case WMFW_ADSP2_YM: |
663 | BUG_ON(!mem); | ||
664 | region_name = "YM"; | 662 | region_name = "YM"; |
665 | reg = wm_adsp_region_to_reg(mem, offset); | 663 | reg = wm_adsp_region_to_reg(mem, offset); |
666 | break; | 664 | break; |
667 | case WMFW_ADSP1_ZM: | 665 | case WMFW_ADSP1_ZM: |
668 | BUG_ON(!mem); | ||
669 | region_name = "ZM"; | 666 | region_name = "ZM"; |
670 | reg = wm_adsp_region_to_reg(mem, offset); | 667 | reg = wm_adsp_region_to_reg(mem, offset); |
671 | break; | 668 | break; |
@@ -905,10 +902,8 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) | |||
905 | break; | 902 | break; |
906 | } | 903 | } |
907 | 904 | ||
908 | if (mem == NULL) { | 905 | if (WARN_ON(!mem)) |
909 | BUG_ON(mem != NULL); | ||
910 | return -EINVAL; | 906 | return -EINVAL; |
911 | } | ||
912 | 907 | ||
913 | switch (dsp->type) { | 908 | switch (dsp->type) { |
914 | case WMFW_ADSP1: | 909 | case WMFW_ADSP1: |
@@ -1002,7 +997,7 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) | |||
1002 | break; | 997 | break; |
1003 | 998 | ||
1004 | default: | 999 | default: |
1005 | BUG_ON(NULL == "Unknown DSP type"); | 1000 | WARN(1, "Unknown DSP type"); |
1006 | return -EINVAL; | 1001 | return -EINVAL; |
1007 | } | 1002 | } |
1008 | 1003 | ||
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index 01daf655e20b..b371066dd5bc 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
@@ -611,7 +611,7 @@ static int earpiece_event(struct snd_soc_dapm_widget *w, | |||
611 | break; | 611 | break; |
612 | 612 | ||
613 | default: | 613 | default: |
614 | BUG(); | 614 | WARN(1, "Invalid event %d\n", event); |
615 | break; | 615 | break; |
616 | } | 616 | } |
617 | 617 | ||
diff --git a/sound/soc/mid-x86/sst_platform.c b/sound/soc/mid-x86/sst_platform.c index 392fc0b8f5b8..b6b5eb698d33 100644 --- a/sound/soc/mid-x86/sst_platform.c +++ b/sound/soc/mid-x86/sst_platform.c | |||
@@ -40,7 +40,8 @@ static DEFINE_MUTEX(sst_lock); | |||
40 | 40 | ||
41 | int sst_register_dsp(struct sst_device *dev) | 41 | int sst_register_dsp(struct sst_device *dev) |
42 | { | 42 | { |
43 | BUG_ON(!dev); | 43 | if (WARN_ON(!dev)) |
44 | return -EINVAL; | ||
44 | if (!try_module_get(dev->dev->driver->owner)) | 45 | if (!try_module_get(dev->dev->driver->owner)) |
45 | return -ENODEV; | 46 | return -ENODEV; |
46 | mutex_lock(&sst_lock); | 47 | mutex_lock(&sst_lock); |
@@ -59,7 +60,8 @@ EXPORT_SYMBOL_GPL(sst_register_dsp); | |||
59 | 60 | ||
60 | int sst_unregister_dsp(struct sst_device *dev) | 61 | int sst_unregister_dsp(struct sst_device *dev) |
61 | { | 62 | { |
62 | BUG_ON(!dev); | 63 | if (WARN_ON(!dev)) |
64 | return -EINVAL; | ||
63 | if (dev != sst) | 65 | if (dev != sst) |
64 | return -EINVAL; | 66 | return -EINVAL; |
65 | 67 | ||
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c index 5e8d640d314f..6d216cb6c19b 100644 --- a/sound/soc/omap/n810.c +++ b/sound/soc/omap/n810.c | |||
@@ -344,8 +344,11 @@ static int __init n810_soc_init(void) | |||
344 | clk_set_parent(sys_clkout2_src, func96m_clk); | 344 | clk_set_parent(sys_clkout2_src, func96m_clk); |
345 | clk_set_rate(sys_clkout2, 12000000); | 345 | clk_set_rate(sys_clkout2, 12000000); |
346 | 346 | ||
347 | BUG_ON((gpio_request(N810_HEADSET_AMP_GPIO, "hs_amp") < 0) || | 347 | if (WARN_ON((gpio_request(N810_HEADSET_AMP_GPIO, "hs_amp") < 0) || |
348 | (gpio_request(N810_SPEAKER_AMP_GPIO, "spk_amp") < 0)); | 348 | (gpio_request(N810_SPEAKER_AMP_GPIO, "spk_amp") < 0))) { |
349 | err = -EINVAL; | ||
350 | goto err4; | ||
351 | } | ||
349 | 352 | ||
350 | gpio_direction_output(N810_HEADSET_AMP_GPIO, 0); | 353 | gpio_direction_output(N810_HEADSET_AMP_GPIO, 0); |
351 | gpio_direction_output(N810_SPEAKER_AMP_GPIO, 0); | 354 | gpio_direction_output(N810_SPEAKER_AMP_GPIO, 0); |
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c index d5340a088858..c0d648d3339f 100644 --- a/sound/soc/pxa/pxa2xx-i2s.c +++ b/sound/soc/pxa/pxa2xx-i2s.c | |||
@@ -165,7 +165,8 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream, | |||
165 | { | 165 | { |
166 | struct snd_dmaengine_dai_dma_data *dma_data; | 166 | struct snd_dmaengine_dai_dma_data *dma_data; |
167 | 167 | ||
168 | BUG_ON(IS_ERR(clk_i2s)); | 168 | if (WARN_ON(IS_ERR(clk_i2s))) |
169 | return -EINVAL; | ||
169 | clk_prepare_enable(clk_i2s); | 170 | clk_prepare_enable(clk_i2s); |
170 | clk_ena = 1; | 171 | clk_ena = 1; |
171 | pxa_i2s_wait(); | 172 | pxa_i2s_wait(); |
diff --git a/sound/soc/s6000/s6000-pcm.c b/sound/soc/s6000/s6000-pcm.c index d0740a762963..5cfaa5464eba 100644 --- a/sound/soc/s6000/s6000-pcm.c +++ b/sound/soc/s6000/s6000-pcm.c | |||
@@ -90,7 +90,8 @@ static void s6000_pcm_enqueue_dma(struct snd_pcm_substream *substream) | |||
90 | return; | 90 | return; |
91 | } | 91 | } |
92 | 92 | ||
93 | BUG_ON(period_size & 15); | 93 | if (WARN_ON(period_size & 15)) |
94 | return; | ||
94 | s6dmac_put_fifo(DMA_MASK_DMAC(channel), DMA_INDEX_CHNL(channel), | 95 | s6dmac_put_fifo(DMA_MASK_DMAC(channel), DMA_INDEX_CHNL(channel), |
95 | src, dst, period_size); | 96 | src, dst, period_size); |
96 | 97 | ||
diff --git a/sound/soc/sh/rcar/scu.c b/sound/soc/sh/rcar/scu.c index 1ab1bce6be7f..f4453e33a847 100644 --- a/sound/soc/sh/rcar/scu.c +++ b/sound/soc/sh/rcar/scu.c | |||
@@ -198,7 +198,8 @@ static struct rsnd_mod_ops rsnd_scu_ops = { | |||
198 | 198 | ||
199 | struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id) | 199 | struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id) |
200 | { | 200 | { |
201 | BUG_ON(id < 0 || id >= rsnd_scu_nr(priv)); | 201 | if (WARN_ON(id < 0 || id >= rsnd_scu_nr(priv))) |
202 | id = 0; | ||
202 | 203 | ||
203 | return &((struct rsnd_scu *)(priv->scu) + id)->mod; | 204 | return &((struct rsnd_scu *)(priv->scu) + id)->mod; |
204 | } | 205 | } |
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index b71cf9d7dd3f..5ac20cd5e006 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c | |||
@@ -611,7 +611,8 @@ struct rsnd_mod *rsnd_ssi_mod_get_frm_dai(struct rsnd_priv *priv, | |||
611 | 611 | ||
612 | struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id) | 612 | struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id) |
613 | { | 613 | { |
614 | BUG_ON(id < 0 || id >= rsnd_ssi_nr(priv)); | 614 | if (WARN_ON(id < 0 || id >= rsnd_ssi_nr(priv))) |
615 | id = 0; | ||
615 | 616 | ||
616 | return &(((struct rsnd_ssiu *)(priv->ssiu))->ssi + id)->mod; | 617 | return &(((struct rsnd_ssiu *)(priv->ssiu))->ssi + id)->mod; |
617 | } | 618 | } |
diff --git a/sound/soc/sh/siu_dai.c b/sound/soc/sh/siu_dai.c index 9dc24ffa892a..d55babee14f8 100644 --- a/sound/soc/sh/siu_dai.c +++ b/sound/soc/sh/siu_dai.c | |||
@@ -543,7 +543,8 @@ static void siu_dai_shutdown(struct snd_pcm_substream *substream, | |||
543 | /* Stop the siu if the other stream is not using it */ | 543 | /* Stop the siu if the other stream is not using it */ |
544 | if (!port_info->play_cap) { | 544 | if (!port_info->play_cap) { |
545 | /* during stmread or stmwrite ? */ | 545 | /* during stmread or stmwrite ? */ |
546 | BUG_ON(port_info->playback.rw_flg || port_info->capture.rw_flg); | 546 | if (WARN_ON(port_info->playback.rw_flg || port_info->capture.rw_flg)) |
547 | return; | ||
547 | siu_dai_spbstop(port_info); | 548 | siu_dai_spbstop(port_info); |
548 | siu_dai_stop(port_info); | 549 | siu_dai_stop(port_info); |
549 | } | 550 | } |
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index 1b6663f45b34..375dc6dfba4e 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c | |||
@@ -36,7 +36,8 @@ static bool snd_soc_set_cache_val(void *base, unsigned int idx, | |||
36 | break; | 36 | break; |
37 | } | 37 | } |
38 | default: | 38 | default: |
39 | BUG(); | 39 | WARN(1, "Invalid word_size %d\n", word_size); |
40 | break; | ||
40 | } | 41 | } |
41 | return false; | 42 | return false; |
42 | } | 43 | } |
@@ -57,7 +58,8 @@ static unsigned int snd_soc_get_cache_val(const void *base, unsigned int idx, | |||
57 | return cache[idx]; | 58 | return cache[idx]; |
58 | } | 59 | } |
59 | default: | 60 | default: |
60 | BUG(); | 61 | WARN(1, "Invalid word_size %d\n", word_size); |
62 | break; | ||
61 | } | 63 | } |
62 | /* unreachable */ | 64 | /* unreachable */ |
63 | return -1; | 65 | return -1; |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 0580d144a8c9..5738c19ef147 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -1416,7 +1416,7 @@ static void dapm_seq_check_event(struct snd_soc_card *card, | |||
1416 | power = 0; | 1416 | power = 0; |
1417 | break; | 1417 | break; |
1418 | default: | 1418 | default: |
1419 | BUG(); | 1419 | WARN(1, "Unknown event %d\n", event); |
1420 | return; | 1420 | return; |
1421 | } | 1421 | } |
1422 | 1422 | ||
@@ -1448,7 +1448,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_card *card, | |||
1448 | power_list)->reg; | 1448 | power_list)->reg; |
1449 | 1449 | ||
1450 | list_for_each_entry(w, pending, power_list) { | 1450 | list_for_each_entry(w, pending, power_list) { |
1451 | BUG_ON(reg != w->reg); | 1451 | WARN_ON(reg != w->reg); |
1452 | w->power = w->new_power; | 1452 | w->power = w->new_power; |
1453 | 1453 | ||
1454 | mask |= w->mask << w->shift; | 1454 | mask |= w->mask << w->shift; |
@@ -2006,7 +2006,7 @@ static ssize_t dapm_bias_read_file(struct file *file, char __user *user_buf, | |||
2006 | level = "Off\n"; | 2006 | level = "Off\n"; |
2007 | break; | 2007 | break; |
2008 | default: | 2008 | default: |
2009 | BUG(); | 2009 | WARN(1, "Unknown bias_level %d\n", dapm->bias_level); |
2010 | level = "Unknown\n"; | 2010 | level = "Unknown\n"; |
2011 | break; | 2011 | break; |
2012 | } | 2012 | } |
@@ -3339,8 +3339,9 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, | |||
3339 | u64 fmt; | 3339 | u64 fmt; |
3340 | int ret; | 3340 | int ret; |
3341 | 3341 | ||
3342 | BUG_ON(!config); | 3342 | if (WARN_ON(!config) || |
3343 | BUG_ON(list_empty(&w->sources) || list_empty(&w->sinks)); | 3343 | WARN_ON(list_empty(&w->sources) || list_empty(&w->sinks))) |
3344 | return -EINVAL; | ||
3344 | 3345 | ||
3345 | /* We only support a single source and sink, pick the first */ | 3346 | /* We only support a single source and sink, pick the first */ |
3346 | source_p = list_first_entry(&w->sources, struct snd_soc_dapm_path, | 3347 | source_p = list_first_entry(&w->sources, struct snd_soc_dapm_path, |
@@ -3348,9 +3349,10 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, | |||
3348 | sink_p = list_first_entry(&w->sinks, struct snd_soc_dapm_path, | 3349 | sink_p = list_first_entry(&w->sinks, struct snd_soc_dapm_path, |
3349 | list_source); | 3350 | list_source); |
3350 | 3351 | ||
3351 | BUG_ON(!source_p || !sink_p); | 3352 | if (WARN_ON(!source_p || !sink_p) || |
3352 | BUG_ON(!sink_p->source || !source_p->sink); | 3353 | WARN_ON(!sink_p->source || !source_p->sink) || |
3353 | BUG_ON(!source_p->source || !sink_p->sink); | 3354 | WARN_ON(!source_p->source || !sink_p->sink)) |
3355 | return -EINVAL; | ||
3354 | 3356 | ||
3355 | source = source_p->source->priv; | 3357 | source = source_p->source->priv; |
3356 | sink = sink_p->sink->priv; | 3358 | sink = sink_p->sink->priv; |
@@ -3426,7 +3428,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, | |||
3426 | break; | 3428 | break; |
3427 | 3429 | ||
3428 | default: | 3430 | default: |
3429 | BUG(); | 3431 | WARN(1, "Unknown event %d\n", event); |
3430 | return -EINVAL; | 3432 | return -EINVAL; |
3431 | } | 3433 | } |
3432 | 3434 | ||
diff --git a/sound/soc/txx9/txx9aclc.c b/sound/soc/txx9/txx9aclc.c index 45a6428cba8d..fbd077f4de72 100644 --- a/sound/soc/txx9/txx9aclc.c +++ b/sound/soc/txx9/txx9aclc.c | |||
@@ -115,8 +115,8 @@ static void txx9aclc_dma_complete(void *arg) | |||
115 | spin_lock_irqsave(&dmadata->dma_lock, flags); | 115 | spin_lock_irqsave(&dmadata->dma_lock, flags); |
116 | if (dmadata->frag_count >= 0) { | 116 | if (dmadata->frag_count >= 0) { |
117 | dmadata->dmacount--; | 117 | dmadata->dmacount--; |
118 | BUG_ON(dmadata->dmacount < 0); | 118 | if (!WARN_ON(dmadata->dmacount < 0)) |
119 | tasklet_schedule(&dmadata->tasklet); | 119 | tasklet_schedule(&dmadata->tasklet); |
120 | } | 120 | } |
121 | spin_unlock_irqrestore(&dmadata->dma_lock, flags); | 121 | spin_unlock_irqrestore(&dmadata->dma_lock, flags); |
122 | } | 122 | } |
@@ -181,7 +181,10 @@ static void txx9aclc_dma_tasklet(unsigned long data) | |||
181 | spin_unlock_irqrestore(&dmadata->dma_lock, flags); | 181 | spin_unlock_irqrestore(&dmadata->dma_lock, flags); |
182 | return; | 182 | return; |
183 | } | 183 | } |
184 | BUG_ON(dmadata->dmacount >= NR_DMA_CHAIN); | 184 | if (WARN_ON(dmadata->dmacount >= NR_DMA_CHAIN)) { |
185 | spin_unlock_irqrestore(&dmadata->dma_lock, flags); | ||
186 | return; | ||
187 | } | ||
185 | while (dmadata->dmacount < NR_DMA_CHAIN) { | 188 | while (dmadata->dmacount < NR_DMA_CHAIN) { |
186 | dmadata->dmacount++; | 189 | dmadata->dmacount++; |
187 | spin_unlock_irqrestore(&dmadata->dma_lock, flags); | 190 | spin_unlock_irqrestore(&dmadata->dma_lock, flags); |