aboutsummaryrefslogtreecommitdiffstats
path: root/sound/drivers/vx
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-08-08 11:12:47 -0400
committerJaroslav Kysela <perex@perex.cz>2008-08-13 05:46:40 -0400
commit5e246b850df563224be26f1d409cf66fd6c968df (patch)
tree970e7faf60b86cb2c489a08ca506075c398165e5 /sound/drivers/vx
parentda3cec35dd3c31d8706db4bf379372ce70d92118 (diff)
ALSA: Kill snd_assert() in other places
Kill snd_assert() in other places, either removed or replaced with if () with snd_BUG_ON(). Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/drivers/vx')
-rw-r--r--sound/drivers/vx/vx_cmd.c3
-rw-r--r--sound/drivers/vx/vx_core.c21
-rw-r--r--sound/drivers/vx/vx_hwdep.c6
-rw-r--r--sound/drivers/vx/vx_mixer.c3
-rw-r--r--sound/drivers/vx/vx_pcm.c9
-rw-r--r--sound/drivers/vx/vx_uer.c6
6 files changed, 32 insertions, 16 deletions
diff --git a/sound/drivers/vx/vx_cmd.c b/sound/drivers/vx/vx_cmd.c
index 9529e3bf2866..23f4857f02c8 100644
--- a/sound/drivers/vx/vx_cmd.c
+++ b/sound/drivers/vx/vx_cmd.c
@@ -99,7 +99,8 @@ static struct vx_cmd_info vx_dsp_cmds[] = {
99 */ 99 */
100void vx_init_rmh(struct vx_rmh *rmh, unsigned int cmd) 100void vx_init_rmh(struct vx_rmh *rmh, unsigned int cmd)
101{ 101{
102 snd_assert(cmd < CMD_LAST_INDEX, return); 102 if (snd_BUG_ON(cmd >= CMD_LAST_INDEX))
103 return;
103 rmh->LgCmd = vx_dsp_cmds[cmd].length; 104 rmh->LgCmd = vx_dsp_cmds[cmd].length;
104 rmh->LgStat = vx_dsp_cmds[cmd].st_length; 105 rmh->LgStat = vx_dsp_cmds[cmd].st_length;
105 rmh->DspStat = vx_dsp_cmds[cmd].st_type; 106 rmh->DspStat = vx_dsp_cmds[cmd].st_type;
diff --git a/sound/drivers/vx/vx_core.c b/sound/drivers/vx/vx_core.c
index 585af2eb1438..473b07f6ae85 100644
--- a/sound/drivers/vx/vx_core.c
+++ b/sound/drivers/vx/vx_core.c
@@ -205,7 +205,8 @@ static int vx_read_status(struct vx_core *chip, struct vx_rmh *rmh)
205 205
206 if (size < 1) 206 if (size < 1)
207 return 0; 207 return 0;
208 snd_assert(size <= SIZE_MAX_STATUS, return -EINVAL); 208 if (snd_BUG_ON(size > SIZE_MAX_STATUS))
209 return -EINVAL;
209 210
210 for (i = 1; i <= size; i++) { 211 for (i = 1; i <= size; i++) {
211 /* trigger an irq MESS_WRITE_NEXT */ 212 /* trigger an irq MESS_WRITE_NEXT */
@@ -425,13 +426,16 @@ int snd_vx_load_boot_image(struct vx_core *chip, const struct firmware *boot)
425 int no_fillup = vx_has_new_dsp(chip); 426 int no_fillup = vx_has_new_dsp(chip);
426 427
427 /* check the length of boot image */ 428 /* check the length of boot image */
428 snd_assert(boot->size > 0, return -EINVAL); 429 if (boot->size <= 0)
429 snd_assert(boot->size % 3 == 0, return -EINVAL); 430 return -EINVAL;
431 if (boot->size % 3)
432 return -EINVAL;
430#if 0 433#if 0
431 { 434 {
432 /* more strict check */ 435 /* more strict check */
433 unsigned int c = ((u32)boot->data[0] << 16) | ((u32)boot->data[1] << 8) | boot->data[2]; 436 unsigned int c = ((u32)boot->data[0] << 16) | ((u32)boot->data[1] << 8) | boot->data[2];
434 snd_assert(boot->size == (c + 2) * 3, return -EINVAL); 437 if (boot->size != (c + 2) * 3)
438 return -EINVAL;
435 } 439 }
436#endif 440#endif
437 441
@@ -554,7 +558,8 @@ EXPORT_SYMBOL(snd_vx_irq_handler);
554 */ 558 */
555static void vx_reset_board(struct vx_core *chip, int cold_reset) 559static void vx_reset_board(struct vx_core *chip, int cold_reset)
556{ 560{
557 snd_assert(chip->ops->reset_board, return); 561 if (snd_BUG_ON(!chip->ops->reset_board))
562 return;
558 563
559 /* current source, later sync'ed with target */ 564 /* current source, later sync'ed with target */
560 chip->audio_source = VX_AUDIO_SRC_LINE; 565 chip->audio_source = VX_AUDIO_SRC_LINE;
@@ -673,7 +678,8 @@ int snd_vx_dsp_load(struct vx_core *chip, const struct firmware *dsp)
673 unsigned int csum = 0; 678 unsigned int csum = 0;
674 const unsigned char *image, *cptr; 679 const unsigned char *image, *cptr;
675 680
676 snd_assert(dsp->size % 3 == 0, return -EINVAL); 681 if (dsp->size % 3)
682 return -EINVAL;
677 683
678 vx_toggle_dac_mute(chip, 1); 684 vx_toggle_dac_mute(chip, 1);
679 685
@@ -775,7 +781,8 @@ struct vx_core *snd_vx_create(struct snd_card *card, struct snd_vx_hardware *hw,
775{ 781{
776 struct vx_core *chip; 782 struct vx_core *chip;
777 783
778 snd_assert(card && hw && ops, return NULL); 784 if (snd_BUG_ON(!card || !hw || !ops))
785 return NULL;
779 786
780 chip = kzalloc(sizeof(*chip) + extra_size, GFP_KERNEL); 787 chip = kzalloc(sizeof(*chip) + extra_size, GFP_KERNEL);
781 if (! chip) { 788 if (! chip) {
diff --git a/sound/drivers/vx/vx_hwdep.c b/sound/drivers/vx/vx_hwdep.c
index efd22e92bced..8d6362e2d4c9 100644
--- a/sound/drivers/vx/vx_hwdep.c
+++ b/sound/drivers/vx/vx_hwdep.c
@@ -141,7 +141,8 @@ static int vx_hwdep_dsp_status(struct snd_hwdep *hw,
141 }; 141 };
142 struct vx_core *vx = hw->private_data; 142 struct vx_core *vx = hw->private_data;
143 143
144 snd_assert(type_ids[vx->type], return -EINVAL); 144 if (snd_BUG_ON(!type_ids[vx->type]))
145 return -EINVAL;
145 strcpy(info->id, type_ids[vx->type]); 146 strcpy(info->id, type_ids[vx->type]);
146 if (vx_is_pcmcia(vx)) 147 if (vx_is_pcmcia(vx))
147 info->num_dsps = 4; 148 info->num_dsps = 4;
@@ -168,7 +169,8 @@ static int vx_hwdep_dsp_load(struct snd_hwdep *hw,
168 int index, err; 169 int index, err;
169 struct firmware *fw; 170 struct firmware *fw;
170 171
171 snd_assert(vx->ops->load_dsp, return -ENXIO); 172 if (snd_BUG_ON(!vx->ops->load_dsp))
173 return -ENXIO;
172 174
173 fw = kmalloc(sizeof(*fw), GFP_KERNEL); 175 fw = kmalloc(sizeof(*fw), GFP_KERNEL);
174 if (! fw) { 176 if (! fw) {
diff --git a/sound/drivers/vx/vx_mixer.c b/sound/drivers/vx/vx_mixer.c
index 5a347321f8c0..c71b8d148d7f 100644
--- a/sound/drivers/vx/vx_mixer.c
+++ b/sound/drivers/vx/vx_mixer.c
@@ -34,7 +34,8 @@ static void vx_write_codec_reg(struct vx_core *chip, int codec, unsigned int dat
34{ 34{
35 unsigned long flags; 35 unsigned long flags;
36 36
37 snd_assert(chip->ops->write_codec, return); 37 if (snd_BUG_ON(!chip->ops->write_codec))
38 return;
38 39
39 if (chip->chip_status & VX_STAT_IS_STALE) 40 if (chip->chip_status & VX_STAT_IS_STALE)
40 return; 41 return;
diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c
index fdbf86571b1f..27de574c08f7 100644
--- a/sound/drivers/vx/vx_pcm.c
+++ b/sound/drivers/vx/vx_pcm.c
@@ -587,7 +587,8 @@ static int vx_pcm_playback_open(struct snd_pcm_substream *subs)
587 return -EBUSY; 587 return -EBUSY;
588 588
589 audio = subs->pcm->device * 2; 589 audio = subs->pcm->device * 2;
590 snd_assert(audio < chip->audio_outs, return -EINVAL); 590 if (snd_BUG_ON(audio >= chip->audio_outs))
591 return -EINVAL;
591 592
592 /* playback pipe may have been already allocated for monitoring */ 593 /* playback pipe may have been already allocated for monitoring */
593 pipe = chip->playback_pipes[audio]; 594 pipe = chip->playback_pipes[audio];
@@ -996,7 +997,8 @@ static int vx_pcm_capture_open(struct snd_pcm_substream *subs)
996 return -EBUSY; 997 return -EBUSY;
997 998
998 audio = subs->pcm->device * 2; 999 audio = subs->pcm->device * 2;
999 snd_assert(audio < chip->audio_ins, return -EINVAL); 1000 if (snd_BUG_ON(audio >= chip->audio_ins))
1001 return -EINVAL;
1000 err = vx_alloc_pipe(chip, 1, audio, 2, &pipe); 1002 err = vx_alloc_pipe(chip, 1, audio, 2, &pipe);
1001 if (err < 0) 1003 if (err < 0)
1002 return err; 1004 return err;
@@ -1214,7 +1216,8 @@ void vx_pcm_update_intr(struct vx_core *chip, unsigned int events)
1214 } 1216 }
1215 if (capture) 1217 if (capture)
1216 continue; 1218 continue;
1217 snd_assert(p >= 0 && (unsigned int)p < chip->audio_outs,); 1219 if (snd_BUG_ON(p < 0 || p >= chip->audio_outs))
1220 continue;
1218 pipe = chip->playback_pipes[p]; 1221 pipe = chip->playback_pipes[p];
1219 if (pipe && pipe->substream) { 1222 if (pipe && pipe->substream) {
1220 vx_pcm_playback_update(chip, pipe->substream, pipe); 1223 vx_pcm_playback_update(chip, pipe->substream, pipe);
diff --git a/sound/drivers/vx/vx_uer.c b/sound/drivers/vx/vx_uer.c
index fb8932af888d..0e1ba9b47904 100644
--- a/sound/drivers/vx/vx_uer.c
+++ b/sound/drivers/vx/vx_uer.c
@@ -163,13 +163,15 @@ static int vx_calc_clock_from_freq(struct vx_core *chip, int freq)
163{ 163{
164 int hexfreq; 164 int hexfreq;
165 165
166 snd_assert(freq > 0, return 0); 166 if (snd_BUG_ON(freq <= 0))
167 return 0;
167 168
168 hexfreq = (28224000 * 10) / freq; 169 hexfreq = (28224000 * 10) / freq;
169 hexfreq = (hexfreq + 5) / 10; 170 hexfreq = (hexfreq + 5) / 10;
170 171
171 /* max freq = 55125 Hz */ 172 /* max freq = 55125 Hz */
172 snd_assert(hexfreq > 0x00000200, return 0); 173 if (snd_BUG_ON(hexfreq <= 0x00000200))
174 return 0;
173 175
174 if (hexfreq <= 0x03ff) 176 if (hexfreq <= 0x03ff)
175 return hexfreq - 0x00000201; 177 return hexfreq - 0x00000201;