diff options
Diffstat (limited to 'sound/drivers')
-rw-r--r-- | sound/drivers/dummy.c | 41 | ||||
-rw-r--r-- | sound/drivers/mtpav.c | 8 | ||||
-rw-r--r-- | sound/drivers/opl3/opl3_lib.c | 6 | ||||
-rw-r--r-- | sound/drivers/opl3/opl3_midi.c | 6 | ||||
-rw-r--r-- | sound/drivers/opl3/opl3_oss.c | 15 | ||||
-rw-r--r-- | sound/drivers/opl3/opl3_synth.c | 3 | ||||
-rw-r--r-- | sound/drivers/opl4/opl4_synth.c | 2 | ||||
-rw-r--r-- | sound/drivers/vx/vx_cmd.c | 3 | ||||
-rw-r--r-- | sound/drivers/vx/vx_core.c | 21 | ||||
-rw-r--r-- | sound/drivers/vx/vx_hwdep.c | 6 | ||||
-rw-r--r-- | sound/drivers/vx/vx_mixer.c | 3 | ||||
-rw-r--r-- | sound/drivers/vx/vx_pcm.c | 9 | ||||
-rw-r--r-- | sound/drivers/vx/vx_uer.c | 6 |
13 files changed, 82 insertions, 47 deletions
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c index 4e4c69e6cb4c..e5e749f3e0ef 100644 --- a/sound/drivers/dummy.c +++ b/sound/drivers/dummy.c | |||
@@ -47,9 +47,11 @@ MODULE_SUPPORTED_DEVICE("{{ALSA,Dummy soundcard}}"); | |||
47 | static int emu10k1_playback_constraints(struct snd_pcm_runtime *runtime) | 47 | static int emu10k1_playback_constraints(struct snd_pcm_runtime *runtime) |
48 | { | 48 | { |
49 | int err; | 49 | int err; |
50 | if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) | 50 | err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); |
51 | if (err < 0) | ||
51 | return err; | 52 | return err; |
52 | if ((err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 256, UINT_MAX)) < 0) | 53 | err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 256, UINT_MAX); |
54 | if (err) < 0) | ||
53 | return err; | 55 | return err; |
54 | return 0; | 56 | return 0; |
55 | } | 57 | } |
@@ -354,6 +356,7 @@ static int snd_card_dummy_playback_open(struct snd_pcm_substream *substream) | |||
354 | if ((dpcm = new_pcm_stream(substream)) == NULL) | 356 | if ((dpcm = new_pcm_stream(substream)) == NULL) |
355 | return -ENOMEM; | 357 | return -ENOMEM; |
356 | runtime->private_data = dpcm; | 358 | runtime->private_data = dpcm; |
359 | /* makes the infrastructure responsible for freeing dpcm */ | ||
357 | runtime->private_free = snd_card_dummy_runtime_free; | 360 | runtime->private_free = snd_card_dummy_runtime_free; |
358 | runtime->hw = snd_card_dummy_playback; | 361 | runtime->hw = snd_card_dummy_playback; |
359 | if (substream->pcm->device & 1) { | 362 | if (substream->pcm->device & 1) { |
@@ -362,10 +365,9 @@ static int snd_card_dummy_playback_open(struct snd_pcm_substream *substream) | |||
362 | } | 365 | } |
363 | if (substream->pcm->device & 2) | 366 | if (substream->pcm->device & 2) |
364 | runtime->hw.info &= ~(SNDRV_PCM_INFO_MMAP|SNDRV_PCM_INFO_MMAP_VALID); | 367 | runtime->hw.info &= ~(SNDRV_PCM_INFO_MMAP|SNDRV_PCM_INFO_MMAP_VALID); |
365 | if ((err = add_playback_constraints(runtime)) < 0) { | 368 | err = add_playback_constraints(runtime); |
366 | kfree(dpcm); | 369 | if (err < 0) |
367 | return err; | 370 | return err; |
368 | } | ||
369 | 371 | ||
370 | return 0; | 372 | return 0; |
371 | } | 373 | } |
@@ -379,6 +381,7 @@ static int snd_card_dummy_capture_open(struct snd_pcm_substream *substream) | |||
379 | if ((dpcm = new_pcm_stream(substream)) == NULL) | 381 | if ((dpcm = new_pcm_stream(substream)) == NULL) |
380 | return -ENOMEM; | 382 | return -ENOMEM; |
381 | runtime->private_data = dpcm; | 383 | runtime->private_data = dpcm; |
384 | /* makes the infrastructure responsible for freeing dpcm */ | ||
382 | runtime->private_free = snd_card_dummy_runtime_free; | 385 | runtime->private_free = snd_card_dummy_runtime_free; |
383 | runtime->hw = snd_card_dummy_capture; | 386 | runtime->hw = snd_card_dummy_capture; |
384 | if (substream->pcm->device == 1) { | 387 | if (substream->pcm->device == 1) { |
@@ -387,10 +390,9 @@ static int snd_card_dummy_capture_open(struct snd_pcm_substream *substream) | |||
387 | } | 390 | } |
388 | if (substream->pcm->device & 2) | 391 | if (substream->pcm->device & 2) |
389 | runtime->hw.info &= ~(SNDRV_PCM_INFO_MMAP|SNDRV_PCM_INFO_MMAP_VALID); | 392 | runtime->hw.info &= ~(SNDRV_PCM_INFO_MMAP|SNDRV_PCM_INFO_MMAP_VALID); |
390 | if ((err = add_capture_constraints(runtime)) < 0) { | 393 | err = add_capture_constraints(runtime); |
391 | kfree(dpcm); | 394 | if (err < 0) |
392 | return err; | 395 | return err; |
393 | } | ||
394 | 396 | ||
395 | return 0; | 397 | return 0; |
396 | } | 398 | } |
@@ -433,8 +435,9 @@ static int __devinit snd_card_dummy_pcm(struct snd_dummy *dummy, int device, | |||
433 | struct snd_pcm *pcm; | 435 | struct snd_pcm *pcm; |
434 | int err; | 436 | int err; |
435 | 437 | ||
436 | if ((err = snd_pcm_new(dummy->card, "Dummy PCM", device, | 438 | err = snd_pcm_new(dummy->card, "Dummy PCM", device, |
437 | substreams, substreams, &pcm)) < 0) | 439 | substreams, substreams, &pcm); |
440 | if (err < 0) | ||
438 | return err; | 441 | return err; |
439 | dummy->pcm = pcm; | 442 | dummy->pcm = pcm; |
440 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_dummy_playback_ops); | 443 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_dummy_playback_ops); |
@@ -565,12 +568,14 @@ static int __devinit snd_card_dummy_new_mixer(struct snd_dummy *dummy) | |||
565 | unsigned int idx; | 568 | unsigned int idx; |
566 | int err; | 569 | int err; |
567 | 570 | ||
568 | snd_assert(dummy != NULL, return -EINVAL); | 571 | if (snd_BUG_ON(!dummy)) |
572 | return -EINVAL; | ||
569 | spin_lock_init(&dummy->mixer_lock); | 573 | spin_lock_init(&dummy->mixer_lock); |
570 | strcpy(card->mixername, "Dummy Mixer"); | 574 | strcpy(card->mixername, "Dummy Mixer"); |
571 | 575 | ||
572 | for (idx = 0; idx < ARRAY_SIZE(snd_dummy_controls); idx++) { | 576 | for (idx = 0; idx < ARRAY_SIZE(snd_dummy_controls); idx++) { |
573 | if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_dummy_controls[idx], dummy))) < 0) | 577 | err = snd_ctl_add(card, snd_ctl_new1(&snd_dummy_controls[idx], dummy)); |
578 | if (err < 0) | ||
574 | return err; | 579 | return err; |
575 | } | 580 | } |
576 | return 0; | 581 | return 0; |
@@ -594,10 +599,12 @@ static int __devinit snd_dummy_probe(struct platform_device *devptr) | |||
594 | pcm_substreams[dev] = 1; | 599 | pcm_substreams[dev] = 1; |
595 | if (pcm_substreams[dev] > MAX_PCM_SUBSTREAMS) | 600 | if (pcm_substreams[dev] > MAX_PCM_SUBSTREAMS) |
596 | pcm_substreams[dev] = MAX_PCM_SUBSTREAMS; | 601 | pcm_substreams[dev] = MAX_PCM_SUBSTREAMS; |
597 | if ((err = snd_card_dummy_pcm(dummy, idx, pcm_substreams[dev])) < 0) | 602 | err = snd_card_dummy_pcm(dummy, idx, pcm_substreams[dev]); |
603 | if (err < 0) | ||
598 | goto __nodev; | 604 | goto __nodev; |
599 | } | 605 | } |
600 | if ((err = snd_card_dummy_new_mixer(dummy)) < 0) | 606 | err = snd_card_dummy_new_mixer(dummy); |
607 | if (err < 0) | ||
601 | goto __nodev; | 608 | goto __nodev; |
602 | strcpy(card->driver, "Dummy"); | 609 | strcpy(card->driver, "Dummy"); |
603 | strcpy(card->shortname, "Dummy"); | 610 | strcpy(card->shortname, "Dummy"); |
@@ -605,7 +612,8 @@ static int __devinit snd_dummy_probe(struct platform_device *devptr) | |||
605 | 612 | ||
606 | snd_card_set_dev(card, &devptr->dev); | 613 | snd_card_set_dev(card, &devptr->dev); |
607 | 614 | ||
608 | if ((err = snd_card_register(card)) == 0) { | 615 | err = snd_card_register(card); |
616 | if (err == 0) { | ||
609 | platform_set_drvdata(devptr, card); | 617 | platform_set_drvdata(devptr, card); |
610 | return 0; | 618 | return 0; |
611 | } | 619 | } |
@@ -668,7 +676,8 @@ static int __init alsa_card_dummy_init(void) | |||
668 | { | 676 | { |
669 | int i, cards, err; | 677 | int i, cards, err; |
670 | 678 | ||
671 | if ((err = platform_driver_register(&snd_dummy_driver)) < 0) | 679 | err = platform_driver_register(&snd_dummy_driver); |
680 | if (err < 0) | ||
672 | return err; | 681 | return err; |
673 | 682 | ||
674 | cards = 0; | 683 | cards = 0; |
diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c index b5e1a71bb64b..5b89c0883d60 100644 --- a/sound/drivers/mtpav.c +++ b/sound/drivers/mtpav.c | |||
@@ -715,6 +715,10 @@ static int __devinit snd_mtpav_probe(struct platform_device *dev) | |||
715 | 715 | ||
716 | card->private_free = snd_mtpav_free; | 716 | card->private_free = snd_mtpav_free; |
717 | 717 | ||
718 | err = snd_mtpav_get_RAWMIDI(mtp_card); | ||
719 | if (err < 0) | ||
720 | goto __error; | ||
721 | |||
718 | err = snd_mtpav_get_ISA(mtp_card); | 722 | err = snd_mtpav_get_ISA(mtp_card); |
719 | if (err < 0) | 723 | if (err < 0) |
720 | goto __error; | 724 | goto __error; |
@@ -724,10 +728,6 @@ static int __devinit snd_mtpav_probe(struct platform_device *dev) | |||
724 | snprintf(card->longname, sizeof(card->longname), | 728 | snprintf(card->longname, sizeof(card->longname), |
725 | "MTPAV on parallel port at 0x%lx", port); | 729 | "MTPAV on parallel port at 0x%lx", port); |
726 | 730 | ||
727 | err = snd_mtpav_get_RAWMIDI(mtp_card); | ||
728 | if (err < 0) | ||
729 | goto __error; | ||
730 | |||
731 | snd_mtpav_portscan(mtp_card); | 731 | snd_mtpav_portscan(mtp_card); |
732 | 732 | ||
733 | snd_card_set_dev(card, &dev->dev); | 733 | snd_card_set_dev(card, &dev->dev); |
diff --git a/sound/drivers/opl3/opl3_lib.c b/sound/drivers/opl3/opl3_lib.c index ebe4359047cb..780582340fef 100644 --- a/sound/drivers/opl3/opl3_lib.c +++ b/sound/drivers/opl3/opl3_lib.c | |||
@@ -139,7 +139,8 @@ static int snd_opl3_detect(struct snd_opl3 * opl3) | |||
139 | * If we had an OPL4 chip, opl3->hardware would have been set | 139 | * If we had an OPL4 chip, opl3->hardware would have been set |
140 | * by the OPL4 driver; so we can assume OPL3 here. | 140 | * by the OPL4 driver; so we can assume OPL3 here. |
141 | */ | 141 | */ |
142 | snd_assert(opl3->r_port != 0, return -ENODEV); | 142 | if (snd_BUG_ON(!opl3->r_port)) |
143 | return -ENODEV; | ||
143 | opl3->hardware = OPL3_HW_OPL3; | 144 | opl3->hardware = OPL3_HW_OPL3; |
144 | } | 145 | } |
145 | return 0; | 146 | return 0; |
@@ -324,7 +325,8 @@ EXPORT_SYMBOL(snd_opl3_interrupt); | |||
324 | 325 | ||
325 | static int snd_opl3_free(struct snd_opl3 *opl3) | 326 | static int snd_opl3_free(struct snd_opl3 *opl3) |
326 | { | 327 | { |
327 | snd_assert(opl3 != NULL, return -ENXIO); | 328 | if (snd_BUG_ON(!opl3)) |
329 | return -ENXIO; | ||
328 | if (opl3->private_free) | 330 | if (opl3->private_free) |
329 | opl3->private_free(opl3); | 331 | opl3->private_free(opl3); |
330 | snd_opl3_clear_patches(opl3); | 332 | snd_opl3_clear_patches(opl3); |
diff --git a/sound/drivers/opl3/opl3_midi.c b/sound/drivers/opl3/opl3_midi.c index cebcb8b78acb..16feafa2c51e 100644 --- a/sound/drivers/opl3/opl3_midi.c +++ b/sound/drivers/opl3/opl3_midi.c | |||
@@ -617,7 +617,8 @@ static void snd_opl3_kill_voice(struct snd_opl3 *opl3, int voice) | |||
617 | 617 | ||
618 | struct snd_opl3_voice *vp, *vp2; | 618 | struct snd_opl3_voice *vp, *vp2; |
619 | 619 | ||
620 | snd_assert(voice < MAX_OPL3_VOICES, return); | 620 | if (snd_BUG_ON(voice >= MAX_OPL3_VOICES)) |
621 | return; | ||
621 | 622 | ||
622 | vp = &opl3->voices[voice]; | 623 | vp = &opl3->voices[voice]; |
623 | if (voice < MAX_OPL2_VOICES) { | 624 | if (voice < MAX_OPL2_VOICES) { |
@@ -737,7 +738,8 @@ static void snd_opl3_update_pitch(struct snd_opl3 *opl3, int voice) | |||
737 | 738 | ||
738 | struct snd_opl3_voice *vp; | 739 | struct snd_opl3_voice *vp; |
739 | 740 | ||
740 | snd_assert(voice < MAX_OPL3_VOICES, return); | 741 | if (snd_BUG_ON(voice >= MAX_OPL3_VOICES)) |
742 | return; | ||
741 | 743 | ||
742 | vp = &opl3->voices[voice]; | 744 | vp = &opl3->voices[voice]; |
743 | if (vp->chan == NULL) | 745 | if (vp->chan == NULL) |
diff --git a/sound/drivers/opl3/opl3_oss.c b/sound/drivers/opl3/opl3_oss.c index 239347f26154..9a2271dc046a 100644 --- a/sound/drivers/opl3/opl3_oss.c +++ b/sound/drivers/opl3/opl3_oss.c | |||
@@ -162,7 +162,8 @@ static int snd_opl3_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure) | |||
162 | struct snd_opl3 *opl3 = closure; | 162 | struct snd_opl3 *opl3 = closure; |
163 | int err; | 163 | int err; |
164 | 164 | ||
165 | snd_assert(arg != NULL, return -ENXIO); | 165 | if (snd_BUG_ON(!arg)) |
166 | return -ENXIO; | ||
166 | 167 | ||
167 | if ((err = snd_opl3_synth_setup(opl3)) < 0) | 168 | if ((err = snd_opl3_synth_setup(opl3)) < 0) |
168 | return err; | 169 | return err; |
@@ -184,7 +185,8 @@ static int snd_opl3_close_seq_oss(struct snd_seq_oss_arg *arg) | |||
184 | { | 185 | { |
185 | struct snd_opl3 *opl3; | 186 | struct snd_opl3 *opl3; |
186 | 187 | ||
187 | snd_assert(arg != NULL, return -ENXIO); | 188 | if (snd_BUG_ON(!arg)) |
189 | return -ENXIO; | ||
188 | opl3 = arg->private_data; | 190 | opl3 = arg->private_data; |
189 | 191 | ||
190 | snd_opl3_synth_cleanup(opl3); | 192 | snd_opl3_synth_cleanup(opl3); |
@@ -206,7 +208,8 @@ static int snd_opl3_load_patch_seq_oss(struct snd_seq_oss_arg *arg, int format, | |||
206 | char name[32]; | 208 | char name[32]; |
207 | int err, type; | 209 | int err, type; |
208 | 210 | ||
209 | snd_assert(arg != NULL, return -ENXIO); | 211 | if (snd_BUG_ON(!arg)) |
212 | return -ENXIO; | ||
210 | opl3 = arg->private_data; | 213 | opl3 = arg->private_data; |
211 | 214 | ||
212 | if (format == FM_PATCH) | 215 | if (format == FM_PATCH) |
@@ -246,7 +249,8 @@ static int snd_opl3_ioctl_seq_oss(struct snd_seq_oss_arg *arg, unsigned int cmd, | |||
246 | { | 249 | { |
247 | struct snd_opl3 *opl3; | 250 | struct snd_opl3 *opl3; |
248 | 251 | ||
249 | snd_assert(arg != NULL, return -ENXIO); | 252 | if (snd_BUG_ON(!arg)) |
253 | return -ENXIO; | ||
250 | opl3 = arg->private_data; | 254 | opl3 = arg->private_data; |
251 | switch (cmd) { | 255 | switch (cmd) { |
252 | case SNDCTL_FM_LOAD_INSTR: | 256 | case SNDCTL_FM_LOAD_INSTR: |
@@ -271,7 +275,8 @@ static int snd_opl3_reset_seq_oss(struct snd_seq_oss_arg *arg) | |||
271 | { | 275 | { |
272 | struct snd_opl3 *opl3; | 276 | struct snd_opl3 *opl3; |
273 | 277 | ||
274 | snd_assert(arg != NULL, return -ENXIO); | 278 | if (snd_BUG_ON(!arg)) |
279 | return -ENXIO; | ||
275 | opl3 = arg->private_data; | 280 | opl3 = arg->private_data; |
276 | 281 | ||
277 | return 0; | 282 | return 0; |
diff --git a/sound/drivers/opl3/opl3_synth.c b/sound/drivers/opl3/opl3_synth.c index fb64c890109b..962bb9c8b9c8 100644 --- a/sound/drivers/opl3/opl3_synth.c +++ b/sound/drivers/opl3/opl3_synth.c | |||
@@ -92,7 +92,8 @@ int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file, | |||
92 | struct snd_opl3 *opl3 = hw->private_data; | 92 | struct snd_opl3 *opl3 = hw->private_data; |
93 | void __user *argp = (void __user *)arg; | 93 | void __user *argp = (void __user *)arg; |
94 | 94 | ||
95 | snd_assert(opl3 != NULL, return -EINVAL); | 95 | if (snd_BUG_ON(!opl3)) |
96 | return -EINVAL; | ||
96 | 97 | ||
97 | switch (cmd) { | 98 | switch (cmd) { |
98 | /* get information */ | 99 | /* get information */ |
diff --git a/sound/drivers/opl4/opl4_synth.c b/sound/drivers/opl4/opl4_synth.c index 74f6e53eae0d..49b9e240915c 100644 --- a/sound/drivers/opl4/opl4_synth.c +++ b/sound/drivers/opl4/opl4_synth.c | |||
@@ -467,7 +467,7 @@ static struct opl4_voice *snd_opl4_get_voice(struct snd_opl4 *opl4) | |||
467 | if (!list_empty(&opl4->off_voices)) | 467 | if (!list_empty(&opl4->off_voices)) |
468 | return list_entry(opl4->off_voices.next, struct opl4_voice, list); | 468 | return list_entry(opl4->off_voices.next, struct opl4_voice, list); |
469 | /* then get the oldest key-on voice */ | 469 | /* then get the oldest key-on voice */ |
470 | snd_assert(!list_empty(&opl4->on_voices), ); | 470 | snd_BUG_ON(list_empty(&opl4->on_voices)); |
471 | return list_entry(opl4->on_voices.next, struct opl4_voice, list); | 471 | return list_entry(opl4->on_voices.next, struct opl4_voice, list); |
472 | } | 472 | } |
473 | 473 | ||
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 | */ |
100 | void vx_init_rmh(struct vx_rmh *rmh, unsigned int cmd) | 100 | void 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 | */ |
555 | static void vx_reset_board(struct vx_core *chip, int cold_reset) | 559 | static 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; |