aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-11-08 10:45:38 -0500
committerTakashi Iwai <tiwai@suse.de>2013-11-08 10:45:38 -0500
commita6bc732b5a96b5403c2637e85c350b95ec6591f3 (patch)
tree4b1c3967cd1de42a5e36e567cbdd18e1f4e8446f /sound/soc
parent9a22a8f558d09a83965d2bbe168294eb8ffb70e9 (diff)
parentdd212bd5bb8b15889821ef79213cdb5bd47c6f85 (diff)
Merge tag 'asoc-v3.13-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Updates for v3.13 Some additional fixes for v3.13, the majority of which are removals and downgrades of BUG()s from Takashi.
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/blackfin/bf5xx-sport.c32
-rw-r--r--sound/soc/codecs/max98088.c8
-rw-r--r--sound/soc/codecs/max98095.c16
-rw-r--r--sound/soc/codecs/tpa6130a2.c21
-rw-r--r--sound/soc/codecs/wm0010.c3
-rw-r--r--sound/soc/codecs/wm2000.c15
-rw-r--r--sound/soc/codecs/wm5100.c3
-rw-r--r--sound/soc/codecs/wm8350.c2
-rw-r--r--sound/soc/codecs/wm8580.c2
-rw-r--r--sound/soc/codecs/wm8776.c3
-rw-r--r--sound/soc/codecs/wm8900.c11
-rw-r--r--sound/soc/codecs/wm8904.c5
-rw-r--r--sound/soc/codecs/wm8958-dsp2.c2
-rw-r--r--sound/soc/codecs/wm8962.c10
-rw-r--r--sound/soc/codecs/wm8996.c12
-rw-r--r--sound/soc/codecs/wm9713.c3
-rw-r--r--sound/soc/codecs/wm_adsp.c22
-rw-r--r--sound/soc/codecs/wm_hubs.c2
-rw-r--r--sound/soc/fsl/fsl_spdif.c5
-rw-r--r--sound/soc/fsl/imx-pcm-fiq.c22
-rw-r--r--sound/soc/fsl/imx-wm8962.c3
-rw-r--r--sound/soc/mid-x86/sst_platform.c6
-rw-r--r--sound/soc/omap/n810.c7
-rw-r--r--sound/soc/pxa/pxa2xx-i2s.c3
-rw-r--r--sound/soc/s6000/s6000-pcm.c3
-rw-r--r--sound/soc/sh/Kconfig1
-rw-r--r--sound/soc/sh/rcar/scu.c3
-rw-r--r--sound/soc/sh/rcar/ssi.c3
-rw-r--r--sound/soc/sh/siu_dai.c3
-rw-r--r--sound/soc/soc-cache.c6
-rw-r--r--sound/soc/soc-core.c33
-rw-r--r--sound/soc/soc-dapm.c20
-rw-r--r--sound/soc/soc-generic-dmaengine-pcm.c2
-rw-r--r--sound/soc/soc-pcm.c11
-rw-r--r--sound/soc/txx9/txx9aclc.c9
35 files changed, 192 insertions, 120 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)
767int sport_set_rx_callback(struct sport_device *sport, 771int 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);
778int sport_set_tx_callback(struct sport_device *sport, 783int 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);
789int sport_set_err_callback(struct sport_device *sport, 795int 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, &param); 869 ret = sport_config_pdev(pdev, &param);
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 bf7804a12863..71ce3159a62e 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),
658static int cp_event(struct snd_soc_dapm_widget *w, 658static 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 3a2f96c5442c..ac1ff9947a90 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -1853,7 +1853,7 @@ static int cp_event(struct snd_soc_dapm_widget *w,
1853 break; 1853 break;
1854 1854
1855 default: 1855 default:
1856 BUG(); 1856 WARN(1, "Invalid event %d\n", event);
1857 return -EINVAL; 1857 return -EINVAL;
1858 } 1858 }
1859 1859
@@ -1945,7 +1945,7 @@ static int hp_event(struct snd_soc_dapm_widget *w,
1945 break; 1945 break;
1946 1946
1947 default: 1947 default:
1948 BUG(); 1948 WARN(1, "Invalid event %d\n", event);
1949 return -EINVAL; 1949 return -EINVAL;
1950 1950
1951 } 1951 }
@@ -1974,7 +1974,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
1974 reg = WM8962_SPKOUTL_VOLUME; 1974 reg = WM8962_SPKOUTL_VOLUME;
1975 break; 1975 break;
1976 default: 1976 default:
1977 BUG(); 1977 WARN(1, "Invalid shift %d\n", w->shift);
1978 return -EINVAL; 1978 return -EINVAL;
1979 } 1979 }
1980 1980
@@ -1982,7 +1982,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
1982 case SND_SOC_DAPM_POST_PMU: 1982 case SND_SOC_DAPM_POST_PMU:
1983 return snd_soc_write(codec, reg, snd_soc_read(codec, reg)); 1983 return snd_soc_write(codec, reg, snd_soc_read(codec, reg));
1984 default: 1984 default:
1985 BUG(); 1985 WARN(1, "Invalid event %d\n", event);
1986 return -EINVAL; 1986 return -EINVAL;
1987 } 1987 }
1988} 1988}
@@ -2005,7 +2005,7 @@ static int dsp2_event(struct snd_soc_dapm_widget *w,
2005 break; 2005 break;
2006 2006
2007 default: 2007 default:
2008 BUG(); 2008 WARN(1, "Invalid event %d\n", event);
2009 return -EINVAL; 2009 return -EINVAL;
2010 } 2010 }
2011 2011
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c
index b70379ebd142..1a7655b0aa22 100644
--- a/sound/soc/codecs/wm8996.c
+++ b/sound/soc/codecs/wm8996.c
@@ -610,7 +610,7 @@ static int bg_event(struct snd_soc_dapm_widget *w,
610 wm8996_bg_disable(codec); 610 wm8996_bg_disable(codec);
611 break; 611 break;
612 default: 612 default:
613 BUG(); 613 WARN(1, "Invalid event %d\n", event);
614 ret = -EINVAL; 614 ret = -EINVAL;
615 } 615 }
616 616
@@ -627,7 +627,7 @@ static int cp_event(struct snd_soc_dapm_widget *w,
627 msleep(5); 627 msleep(5);
628 break; 628 break;
629 default: 629 default:
630 BUG(); 630 WARN(1, "Invalid event %d\n", event);
631 ret = -EINVAL; 631 ret = -EINVAL;
632 } 632 }
633 633
@@ -648,7 +648,7 @@ static int rmv_short_event(struct snd_soc_dapm_widget *w,
648 wm8996->hpout_pending |= w->shift; 648 wm8996->hpout_pending |= w->shift;
649 break; 649 break;
650 default: 650 default:
651 BUG(); 651 WARN(1, "Invalid event %d\n", event);
652 return -EINVAL; 652 return -EINVAL;
653 } 653 }
654 654
@@ -769,7 +769,7 @@ static int dcs_start(struct snd_soc_dapm_widget *w,
769 wm8996->dcs_pending |= 1 << w->shift; 769 wm8996->dcs_pending |= 1 << w->shift;
770 break; 770 break;
771 default: 771 default:
772 BUG(); 772 WARN(1, "Invalid event %d\n", event);
773 return -EINVAL; 773 return -EINVAL;
774 } 774 }
775 775
@@ -1658,7 +1658,7 @@ static int wm8996_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1658 lrclk_rx_reg = WM8996_AIF2_RX_LRCLK_2; 1658 lrclk_rx_reg = WM8996_AIF2_RX_LRCLK_2;
1659 break; 1659 break;
1660 default: 1660 default:
1661 BUG(); 1661 WARN(1, "Invalid dai id %d\n", dai->id);
1662 return -EINVAL; 1662 return -EINVAL;
1663 } 1663 }
1664 1664
@@ -1770,7 +1770,7 @@ static int wm8996_hw_params(struct snd_pcm_substream *substream,
1770 dsp_shift = WM8996_DSP2_DIV_SHIFT; 1770 dsp_shift = WM8996_DSP2_DIV_SHIFT;
1771 break; 1771 break;
1772 default: 1772 default:
1773 BUG(); 1773 WARN(1, "Invalid dai id %d\n", dai->id);
1774 return -EINVAL; 1774 return -EINVAL;
1775 } 1775 }
1776 1776
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 53b6033658a6..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,
341static unsigned int wm_adsp_region_to_reg(struct wm_adsp_region const *region, 341static 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
@@ -1066,6 +1061,7 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
1066 if (i + 1 < algs) { 1061 if (i + 1 < algs) {
1067 region->len = be32_to_cpu(adsp1_alg[i + 1].dm); 1062 region->len = be32_to_cpu(adsp1_alg[i + 1].dm);
1068 region->len -= be32_to_cpu(adsp1_alg[i].dm); 1063 region->len -= be32_to_cpu(adsp1_alg[i].dm);
1064 region->len *= 4;
1069 wm_adsp_create_control(dsp, region); 1065 wm_adsp_create_control(dsp, region);
1070 } else { 1066 } else {
1071 adsp_warn(dsp, "Missing length info for region DM with ID %x\n", 1067 adsp_warn(dsp, "Missing length info for region DM with ID %x\n",
@@ -1083,6 +1079,7 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
1083 if (i + 1 < algs) { 1079 if (i + 1 < algs) {
1084 region->len = be32_to_cpu(adsp1_alg[i + 1].zm); 1080 region->len = be32_to_cpu(adsp1_alg[i + 1].zm);
1085 region->len -= be32_to_cpu(adsp1_alg[i].zm); 1081 region->len -= be32_to_cpu(adsp1_alg[i].zm);
1082 region->len *= 4;
1086 wm_adsp_create_control(dsp, region); 1083 wm_adsp_create_control(dsp, region);
1087 } else { 1084 } else {
1088 adsp_warn(dsp, "Missing length info for region ZM with ID %x\n", 1085 adsp_warn(dsp, "Missing length info for region ZM with ID %x\n",
@@ -1112,6 +1109,7 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
1112 if (i + 1 < algs) { 1109 if (i + 1 < algs) {
1113 region->len = be32_to_cpu(adsp2_alg[i + 1].xm); 1110 region->len = be32_to_cpu(adsp2_alg[i + 1].xm);
1114 region->len -= be32_to_cpu(adsp2_alg[i].xm); 1111 region->len -= be32_to_cpu(adsp2_alg[i].xm);
1112 region->len *= 4;
1115 wm_adsp_create_control(dsp, region); 1113 wm_adsp_create_control(dsp, region);
1116 } else { 1114 } else {
1117 adsp_warn(dsp, "Missing length info for region XM with ID %x\n", 1115 adsp_warn(dsp, "Missing length info for region XM with ID %x\n",
@@ -1129,6 +1127,7 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
1129 if (i + 1 < algs) { 1127 if (i + 1 < algs) {
1130 region->len = be32_to_cpu(adsp2_alg[i + 1].ym); 1128 region->len = be32_to_cpu(adsp2_alg[i + 1].ym);
1131 region->len -= be32_to_cpu(adsp2_alg[i].ym); 1129 region->len -= be32_to_cpu(adsp2_alg[i].ym);
1130 region->len *= 4;
1132 wm_adsp_create_control(dsp, region); 1131 wm_adsp_create_control(dsp, region);
1133 } else { 1132 } else {
1134 adsp_warn(dsp, "Missing length info for region YM with ID %x\n", 1133 adsp_warn(dsp, "Missing length info for region YM with ID %x\n",
@@ -1146,6 +1145,7 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
1146 if (i + 1 < algs) { 1145 if (i + 1 < algs) {
1147 region->len = be32_to_cpu(adsp2_alg[i + 1].zm); 1146 region->len = be32_to_cpu(adsp2_alg[i + 1].zm);
1148 region->len -= be32_to_cpu(adsp2_alg[i].zm); 1147 region->len -= be32_to_cpu(adsp2_alg[i].zm);
1148 region->len *= 4;
1149 wm_adsp_create_control(dsp, region); 1149 wm_adsp_create_control(dsp, region);
1150 } else { 1150 } else {
1151 adsp_warn(dsp, "Missing length info for region ZM with ID %x\n", 1151 adsp_warn(dsp, "Missing length info for region ZM with ID %x\n",
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/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
index 76c742a09ef9..55193a5596ca 100644
--- a/sound/soc/fsl/fsl_spdif.c
+++ b/sound/soc/fsl/fsl_spdif.c
@@ -1107,11 +1107,6 @@ static int fsl_spdif_probe(struct platform_device *pdev)
1107 1107
1108 /* Get the addresses and IRQ */ 1108 /* Get the addresses and IRQ */
1109 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1109 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1110 if (!res) {
1111 dev_err(&pdev->dev, "could not determine device resources\n");
1112 return -ENXIO;
1113 }
1114
1115 regs = devm_ioremap_resource(&pdev->dev, res); 1110 regs = devm_ioremap_resource(&pdev->dev, res);
1116 if (IS_ERR(regs)) 1111 if (IS_ERR(regs))
1117 return PTR_ERR(regs); 1112 return PTR_ERR(regs);
diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
index 34043c55f2a6..10e330514ed8 100644
--- a/sound/soc/fsl/imx-pcm-fiq.c
+++ b/sound/soc/fsl/imx-pcm-fiq.c
@@ -39,8 +39,6 @@ struct imx_pcm_runtime_data {
39 unsigned int period; 39 unsigned int period;
40 int periods; 40 int periods;
41 unsigned long offset; 41 unsigned long offset;
42 unsigned long last_offset;
43 unsigned long size;
44 struct hrtimer hrt; 42 struct hrtimer hrt;
45 int poll_time_ns; 43 int poll_time_ns;
46 struct snd_pcm_substream *substream; 44 struct snd_pcm_substream *substream;
@@ -52,9 +50,7 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt)
52 struct imx_pcm_runtime_data *iprtd = 50 struct imx_pcm_runtime_data *iprtd =
53 container_of(hrt, struct imx_pcm_runtime_data, hrt); 51 container_of(hrt, struct imx_pcm_runtime_data, hrt);
54 struct snd_pcm_substream *substream = iprtd->substream; 52 struct snd_pcm_substream *substream = iprtd->substream;
55 struct snd_pcm_runtime *runtime = substream->runtime;
56 struct pt_regs regs; 53 struct pt_regs regs;
57 unsigned long delta;
58 54
59 if (!atomic_read(&iprtd->running)) 55 if (!atomic_read(&iprtd->running))
60 return HRTIMER_NORESTART; 56 return HRTIMER_NORESTART;
@@ -66,19 +62,7 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt)
66 else 62 else
67 iprtd->offset = regs.ARM_r9 & 0xffff; 63 iprtd->offset = regs.ARM_r9 & 0xffff;
68 64
69 /* How much data have we transferred since the last period report? */ 65 snd_pcm_period_elapsed(substream);
70 if (iprtd->offset >= iprtd->last_offset)
71 delta = iprtd->offset - iprtd->last_offset;
72 else
73 delta = runtime->buffer_size + iprtd->offset
74 - iprtd->last_offset;
75
76 /* If we've transferred at least a period then report it and
77 * reset our poll time */
78 if (delta >= iprtd->period) {
79 snd_pcm_period_elapsed(substream);
80 iprtd->last_offset = iprtd->offset;
81 }
82 66
83 hrtimer_forward_now(hrt, ns_to_ktime(iprtd->poll_time_ns)); 67 hrtimer_forward_now(hrt, ns_to_ktime(iprtd->poll_time_ns));
84 68
@@ -95,11 +79,9 @@ static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream,
95 struct snd_pcm_runtime *runtime = substream->runtime; 79 struct snd_pcm_runtime *runtime = substream->runtime;
96 struct imx_pcm_runtime_data *iprtd = runtime->private_data; 80 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
97 81
98 iprtd->size = params_buffer_bytes(params);
99 iprtd->periods = params_periods(params); 82 iprtd->periods = params_periods(params);
100 iprtd->period = params_period_bytes(params) ; 83 iprtd->period = params_period_bytes(params);
101 iprtd->offset = 0; 84 iprtd->offset = 0;
102 iprtd->last_offset = 0;
103 iprtd->poll_time_ns = 1000000000 / params_rate(params) * 85 iprtd->poll_time_ns = 1000000000 / params_rate(params) *
104 params_period_size(params); 86 params_period_size(params);
105 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); 87 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c
index 72064e995687..361f94f09b11 100644
--- a/sound/soc/fsl/imx-wm8962.c
+++ b/sound/soc/fsl/imx-wm8962.c
@@ -279,8 +279,7 @@ static int imx_wm8962_probe(struct platform_device *pdev)
279 return 0; 279 return 0;
280 280
281clk_fail: 281clk_fail:
282 if (!IS_ERR(data->codec_clk)) 282 clk_disable_unprepare(data->codec_clk);
283 clk_disable_unprepare(data->codec_clk);
284fail: 283fail:
285 if (ssi_np) 284 if (ssi_np)
286 of_node_put(ssi_np); 285 of_node_put(ssi_np);
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
41int sst_register_dsp(struct sst_device *dev) 41int 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
60int sst_unregister_dsp(struct sst_device *dev) 61int 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/Kconfig b/sound/soc/sh/Kconfig
index 56d8ff6a402d..14011d90d70a 100644
--- a/sound/soc/sh/Kconfig
+++ b/sound/soc/sh/Kconfig
@@ -37,7 +37,6 @@ config SND_SOC_SH4_SIU
37config SND_SOC_RCAR 37config SND_SOC_RCAR
38 tristate "R-Car series SRU/SCU/SSIU/SSI support" 38 tristate "R-Car series SRU/SCU/SSIU/SSI support"
39 select SND_SIMPLE_CARD 39 select SND_SIMPLE_CARD
40 select RCAR_CLK_ADG
41 help 40 help
42 This option enables R-Car SUR/SCU/SSIU/SSI sound support 41 This option enables R-Car SUR/SCU/SSIU/SSI sound support
43 42
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
199struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id) 199struct 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
612struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id) 612struct 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-core.c b/sound/soc/soc-core.c
index bdc1d74eb7b0..4e53d87e881d 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -662,6 +662,8 @@ int snd_soc_suspend(struct device *dev)
662 codec->cache_sync = 1; 662 codec->cache_sync = 1;
663 if (codec->using_regmap) 663 if (codec->using_regmap)
664 regcache_mark_dirty(codec->control_data); 664 regcache_mark_dirty(codec->control_data);
665 /* deactivate pins to sleep state */
666 pinctrl_pm_select_sleep_state(codec->dev);
665 break; 667 break;
666 default: 668 default:
667 dev_dbg(codec->dev, 669 dev_dbg(codec->dev,
@@ -679,6 +681,9 @@ int snd_soc_suspend(struct device *dev)
679 681
680 if (cpu_dai->driver->suspend && cpu_dai->driver->ac97_control) 682 if (cpu_dai->driver->suspend && cpu_dai->driver->ac97_control)
681 cpu_dai->driver->suspend(cpu_dai); 683 cpu_dai->driver->suspend(cpu_dai);
684
685 /* deactivate pins to sleep state */
686 pinctrl_pm_select_sleep_state(cpu_dai->dev);
682 } 687 }
683 688
684 if (card->suspend_post) 689 if (card->suspend_post)
@@ -807,6 +812,16 @@ int snd_soc_resume(struct device *dev)
807 if (list_empty(&card->codec_dev_list)) 812 if (list_empty(&card->codec_dev_list))
808 return 0; 813 return 0;
809 814
815 /* activate pins from sleep state */
816 for (i = 0; i < card->num_rtd; i++) {
817 struct snd_soc_dai *cpu_dai = card->rtd[i].cpu_dai;
818 struct snd_soc_dai *codec_dai = card->rtd[i].codec_dai;
819 if (cpu_dai->active)
820 pinctrl_pm_select_default_state(cpu_dai->dev);
821 if (codec_dai->active)
822 pinctrl_pm_select_default_state(codec_dai->dev);
823 }
824
810 /* AC97 devices might have other drivers hanging off them so 825 /* AC97 devices might have other drivers hanging off them so
811 * need to resume immediately. Other drivers don't have that 826 * need to resume immediately. Other drivers don't have that
812 * problem and may take a substantial amount of time to resume 827 * problem and may take a substantial amount of time to resume
@@ -1929,6 +1944,14 @@ int snd_soc_poweroff(struct device *dev)
1929 1944
1930 snd_soc_dapm_shutdown(card); 1945 snd_soc_dapm_shutdown(card);
1931 1946
1947 /* deactivate pins to sleep state */
1948 for (i = 0; i < card->num_rtd; i++) {
1949 struct snd_soc_dai *cpu_dai = card->rtd[i].cpu_dai;
1950 struct snd_soc_dai *codec_dai = card->rtd[i].codec_dai;
1951 pinctrl_pm_select_sleep_state(codec_dai->dev);
1952 pinctrl_pm_select_sleep_state(cpu_dai->dev);
1953 }
1954
1932 return 0; 1955 return 0;
1933} 1956}
1934EXPORT_SYMBOL_GPL(snd_soc_poweroff); 1957EXPORT_SYMBOL_GPL(snd_soc_poweroff);
@@ -3767,6 +3790,16 @@ int snd_soc_register_card(struct snd_soc_card *card)
3767 if (ret != 0) 3790 if (ret != 0)
3768 soc_cleanup_card_debugfs(card); 3791 soc_cleanup_card_debugfs(card);
3769 3792
3793 /* deactivate pins to sleep state */
3794 for (i = 0; i < card->num_rtd; i++) {
3795 struct snd_soc_dai *cpu_dai = card->rtd[i].cpu_dai;
3796 struct snd_soc_dai *codec_dai = card->rtd[i].codec_dai;
3797 if (!codec_dai->active)
3798 pinctrl_pm_select_sleep_state(codec_dai->dev);
3799 if (!cpu_dai->active)
3800 pinctrl_pm_select_sleep_state(cpu_dai->dev);
3801 }
3802
3770 return ret; 3803 return ret;
3771} 3804}
3772EXPORT_SYMBOL_GPL(snd_soc_register_card); 3805EXPORT_SYMBOL_GPL(snd_soc_register_card);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index cc36caaf6443..dcade130157f 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1427,7 +1427,7 @@ static void dapm_seq_check_event(struct snd_soc_card *card,
1427 power = 0; 1427 power = 0;
1428 break; 1428 break;
1429 default: 1429 default:
1430 BUG(); 1430 WARN(1, "Unknown event %d\n", event);
1431 return; 1431 return;
1432 } 1432 }
1433 1433
@@ -1460,7 +1460,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_card *card,
1460 power_list)->reg; 1460 power_list)->reg;
1461 1461
1462 list_for_each_entry(w, pending, power_list) { 1462 list_for_each_entry(w, pending, power_list) {
1463 BUG_ON(reg != w->reg); 1463 WARN_ON(reg != w->reg);
1464 w->power = w->new_power; 1464 w->power = w->new_power;
1465 1465
1466 mask |= w->mask << w->shift; 1466 mask |= w->mask << w->shift;
@@ -2026,7 +2026,7 @@ static ssize_t dapm_bias_read_file(struct file *file, char __user *user_buf,
2026 level = "Off\n"; 2026 level = "Off\n";
2027 break; 2027 break;
2028 default: 2028 default:
2029 BUG(); 2029 WARN(1, "Unknown bias_level %d\n", dapm->bias_level);
2030 level = "Unknown\n"; 2030 level = "Unknown\n";
2031 break; 2031 break;
2032 } 2032 }
@@ -3359,8 +3359,9 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
3359 u64 fmt; 3359 u64 fmt;
3360 int ret; 3360 int ret;
3361 3361
3362 BUG_ON(!config); 3362 if (WARN_ON(!config) ||
3363 BUG_ON(list_empty(&w->sources) || list_empty(&w->sinks)); 3363 WARN_ON(list_empty(&w->sources) || list_empty(&w->sinks)))
3364 return -EINVAL;
3364 3365
3365 /* We only support a single source and sink, pick the first */ 3366 /* We only support a single source and sink, pick the first */
3366 source_p = list_first_entry(&w->sources, struct snd_soc_dapm_path, 3367 source_p = list_first_entry(&w->sources, struct snd_soc_dapm_path,
@@ -3368,9 +3369,10 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
3368 sink_p = list_first_entry(&w->sinks, struct snd_soc_dapm_path, 3369 sink_p = list_first_entry(&w->sinks, struct snd_soc_dapm_path,
3369 list_source); 3370 list_source);
3370 3371
3371 BUG_ON(!source_p || !sink_p); 3372 if (WARN_ON(!source_p || !sink_p) ||
3372 BUG_ON(!sink_p->source || !source_p->sink); 3373 WARN_ON(!sink_p->source || !source_p->sink) ||
3373 BUG_ON(!source_p->source || !sink_p->sink); 3374 WARN_ON(!source_p->source || !sink_p->sink))
3375 return -EINVAL;
3374 3376
3375 source = source_p->source->priv; 3377 source = source_p->source->priv;
3376 sink = sink_p->sink->priv; 3378 sink = sink_p->sink->priv;
@@ -3446,7 +3448,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
3446 break; 3448 break;
3447 3449
3448 default: 3450 default:
3449 BUG(); 3451 WARN(1, "Unknown event %d\n", event);
3450 return -EINVAL; 3452 return -EINVAL;
3451 } 3453 }
3452 3454
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index 51fded3640a5..cbc9c96ce1f4 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -90,6 +90,8 @@ static int dmaengine_pcm_hw_params(struct snd_pcm_substream *substream,
90 struct dma_slave_config slave_config; 90 struct dma_slave_config slave_config;
91 int ret; 91 int ret;
92 92
93 memset(&slave_config, 0, sizeof(slave_config));
94
93 if (!pcm->config) 95 if (!pcm->config)
94 prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config; 96 prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config;
95 else 97 else
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 591f0f3074c5..42782c01e413 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -19,6 +19,7 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/pinctrl/consumer.h>
22#include <linux/pm_runtime.h> 23#include <linux/pm_runtime.h>
23#include <linux/slab.h> 24#include <linux/slab.h>
24#include <linux/workqueue.h> 25#include <linux/workqueue.h>
@@ -183,6 +184,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
183 struct snd_soc_dai_driver *codec_dai_drv = codec_dai->driver; 184 struct snd_soc_dai_driver *codec_dai_drv = codec_dai->driver;
184 int ret = 0; 185 int ret = 0;
185 186
187 pinctrl_pm_select_default_state(cpu_dai->dev);
188 pinctrl_pm_select_default_state(codec_dai->dev);
186 pm_runtime_get_sync(cpu_dai->dev); 189 pm_runtime_get_sync(cpu_dai->dev);
187 pm_runtime_get_sync(codec_dai->dev); 190 pm_runtime_get_sync(codec_dai->dev);
188 pm_runtime_get_sync(platform->dev); 191 pm_runtime_get_sync(platform->dev);
@@ -317,6 +320,10 @@ out:
317 pm_runtime_put(platform->dev); 320 pm_runtime_put(platform->dev);
318 pm_runtime_put(codec_dai->dev); 321 pm_runtime_put(codec_dai->dev);
319 pm_runtime_put(cpu_dai->dev); 322 pm_runtime_put(cpu_dai->dev);
323 if (!codec_dai->active)
324 pinctrl_pm_select_sleep_state(codec_dai->dev);
325 if (!cpu_dai->active)
326 pinctrl_pm_select_sleep_state(cpu_dai->dev);
320 327
321 return ret; 328 return ret;
322} 329}
@@ -426,6 +433,10 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
426 pm_runtime_put(platform->dev); 433 pm_runtime_put(platform->dev);
427 pm_runtime_put(codec_dai->dev); 434 pm_runtime_put(codec_dai->dev);
428 pm_runtime_put(cpu_dai->dev); 435 pm_runtime_put(cpu_dai->dev);
436 if (!codec_dai->active)
437 pinctrl_pm_select_sleep_state(codec_dai->dev);
438 if (!cpu_dai->active)
439 pinctrl_pm_select_sleep_state(cpu_dai->dev);
429 440
430 return 0; 441 return 0;
431} 442}
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);