diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-10-10 05:46:31 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-11-04 07:17:42 -0500 |
commit | 7c22f1aaa23370bf9ba2dd3abbccbed70dced216 (patch) | |
tree | ebc9c1e5cfdab4815afdfab1ba583e6220287252 /sound/core | |
parent | f01cc521a2abef5dba24fb0873b9626ba6b0a0a5 (diff) |
[ALSA] Remove snd_runtime_check() macro
Remove snd_runtime_check() macro.
This macro worsens the readability of codes. They should be either
normal if() or removable asserts.
Also, the assert displays stack-dump, instead of only the last caller
pointer.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/control.c | 18 | ||||
-rw-r--r-- | sound/core/init.c | 5 | ||||
-rw-r--r-- | sound/core/oss/mixer_oss.c | 59 | ||||
-rw-r--r-- | sound/core/pcm.c | 3 | ||||
-rw-r--r-- | sound/core/pcm_lib.c | 3 | ||||
-rw-r--r-- | sound/core/pcm_native.c | 3 | ||||
-rw-r--r-- | sound/core/seq/seq_midi.c | 2 | ||||
-rw-r--r-- | sound/core/timer.c | 3 |
8 files changed, 60 insertions, 36 deletions
diff --git a/sound/core/control.c b/sound/core/control.c index 736edf358e05..212c46a94376 100644 --- a/sound/core/control.c +++ b/sound/core/control.c | |||
@@ -144,7 +144,7 @@ void snd_ctl_notify(snd_card_t *card, unsigned int mask, snd_ctl_elem_id_t *id) | |||
144 | snd_ctl_file_t *ctl; | 144 | snd_ctl_file_t *ctl; |
145 | snd_kctl_event_t *ev; | 145 | snd_kctl_event_t *ev; |
146 | 146 | ||
147 | snd_runtime_check(card != NULL && id != NULL, return); | 147 | snd_assert(card != NULL && id != NULL, return); |
148 | read_lock(&card->ctl_files_rwlock); | 148 | read_lock(&card->ctl_files_rwlock); |
149 | #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) | 149 | #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) |
150 | card->mixer_oss_change_count++; | 150 | card->mixer_oss_change_count++; |
@@ -193,8 +193,8 @@ snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * control, unsigned int access) | |||
193 | snd_kcontrol_t *kctl; | 193 | snd_kcontrol_t *kctl; |
194 | unsigned int idx; | 194 | unsigned int idx; |
195 | 195 | ||
196 | snd_runtime_check(control != NULL, return NULL); | 196 | snd_assert(control != NULL, return NULL); |
197 | snd_runtime_check(control->count > 0, return NULL); | 197 | snd_assert(control->count > 0, return NULL); |
198 | kctl = kzalloc(sizeof(*kctl) + sizeof(snd_kcontrol_volatile_t) * control->count, GFP_KERNEL); | 198 | kctl = kzalloc(sizeof(*kctl) + sizeof(snd_kcontrol_volatile_t) * control->count, GFP_KERNEL); |
199 | if (kctl == NULL) | 199 | if (kctl == NULL) |
200 | return NULL; | 200 | return NULL; |
@@ -220,7 +220,7 @@ snd_kcontrol_t *snd_ctl_new1(const snd_kcontrol_new_t * ncontrol, void *private_ | |||
220 | snd_kcontrol_t kctl; | 220 | snd_kcontrol_t kctl; |
221 | unsigned int access; | 221 | unsigned int access; |
222 | 222 | ||
223 | snd_runtime_check(ncontrol != NULL, return NULL); | 223 | snd_assert(ncontrol != NULL, return NULL); |
224 | snd_assert(ncontrol->info != NULL, return NULL); | 224 | snd_assert(ncontrol->info != NULL, return NULL); |
225 | memset(&kctl, 0, sizeof(kctl)); | 225 | memset(&kctl, 0, sizeof(kctl)); |
226 | kctl.id.iface = ncontrol->iface; | 226 | kctl.id.iface = ncontrol->iface; |
@@ -309,7 +309,7 @@ int snd_ctl_add(snd_card_t * card, snd_kcontrol_t * kcontrol) | |||
309 | snd_ctl_elem_id_t id; | 309 | snd_ctl_elem_id_t id; |
310 | unsigned int idx; | 310 | unsigned int idx; |
311 | 311 | ||
312 | snd_runtime_check(card != NULL && kcontrol != NULL, return -EINVAL); | 312 | snd_assert(card != NULL && kcontrol != NULL, return -EINVAL); |
313 | snd_assert(kcontrol->info != NULL, return -EINVAL); | 313 | snd_assert(kcontrol->info != NULL, return -EINVAL); |
314 | id = kcontrol->id; | 314 | id = kcontrol->id; |
315 | down_write(&card->controls_rwsem); | 315 | down_write(&card->controls_rwsem); |
@@ -355,7 +355,7 @@ int snd_ctl_remove(snd_card_t * card, snd_kcontrol_t * kcontrol) | |||
355 | snd_ctl_elem_id_t id; | 355 | snd_ctl_elem_id_t id; |
356 | unsigned int idx; | 356 | unsigned int idx; |
357 | 357 | ||
358 | snd_runtime_check(card != NULL && kcontrol != NULL, return -EINVAL); | 358 | snd_assert(card != NULL && kcontrol != NULL, return -EINVAL); |
359 | list_del(&kcontrol->list); | 359 | list_del(&kcontrol->list); |
360 | card->controls_count -= kcontrol->count; | 360 | card->controls_count -= kcontrol->count; |
361 | id = kcontrol->id; | 361 | id = kcontrol->id; |
@@ -468,7 +468,7 @@ snd_kcontrol_t *snd_ctl_find_numid(snd_card_t * card, unsigned int numid) | |||
468 | struct list_head *list; | 468 | struct list_head *list; |
469 | snd_kcontrol_t *kctl; | 469 | snd_kcontrol_t *kctl; |
470 | 470 | ||
471 | snd_runtime_check(card != NULL && numid != 0, return NULL); | 471 | snd_assert(card != NULL && numid != 0, return NULL); |
472 | list_for_each(list, &card->controls) { | 472 | list_for_each(list, &card->controls) { |
473 | kctl = snd_kcontrol(list); | 473 | kctl = snd_kcontrol(list); |
474 | if (kctl->id.numid <= numid && kctl->id.numid + kctl->count > numid) | 474 | if (kctl->id.numid <= numid && kctl->id.numid + kctl->count > numid) |
@@ -494,7 +494,7 @@ snd_kcontrol_t *snd_ctl_find_id(snd_card_t * card, snd_ctl_elem_id_t *id) | |||
494 | struct list_head *list; | 494 | struct list_head *list; |
495 | snd_kcontrol_t *kctl; | 495 | snd_kcontrol_t *kctl; |
496 | 496 | ||
497 | snd_runtime_check(card != NULL && id != NULL, return NULL); | 497 | snd_assert(card != NULL && id != NULL, return NULL); |
498 | if (id->numid != 0) | 498 | if (id->numid != 0) |
499 | return snd_ctl_find_numid(card, id->numid); | 499 | return snd_ctl_find_numid(card, id->numid); |
500 | list_for_each(list, &card->controls) { | 500 | list_for_each(list, &card->controls) { |
@@ -1215,7 +1215,7 @@ static int _snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn, struct list_head | |||
1215 | struct list_head *list; | 1215 | struct list_head *list; |
1216 | snd_kctl_ioctl_t *p; | 1216 | snd_kctl_ioctl_t *p; |
1217 | 1217 | ||
1218 | snd_runtime_check(fcn != NULL, return -EINVAL); | 1218 | snd_assert(fcn != NULL, return -EINVAL); |
1219 | down_write(&snd_ioctl_rwsem); | 1219 | down_write(&snd_ioctl_rwsem); |
1220 | list_for_each(list, lists) { | 1220 | list_for_each(list, lists) { |
1221 | p = list_entry(list, snd_kctl_ioctl_t, list); | 1221 | p = list_entry(list, snd_kctl_ioctl_t, list); |
diff --git a/sound/core/init.c b/sound/core/init.c index 41e224986f35..b98f7c6310c5 100644 --- a/sound/core/init.c +++ b/sound/core/init.c | |||
@@ -420,7 +420,7 @@ int snd_card_register(snd_card_t * card) | |||
420 | int err; | 420 | int err; |
421 | snd_info_entry_t *entry; | 421 | snd_info_entry_t *entry; |
422 | 422 | ||
423 | snd_runtime_check(card != NULL, return -EINVAL); | 423 | snd_assert(card != NULL, return -EINVAL); |
424 | if ((err = snd_device_register_all(card)) < 0) | 424 | if ((err = snd_device_register_all(card)) < 0) |
425 | return err; | 425 | return err; |
426 | write_lock(&snd_card_rwlock); | 426 | write_lock(&snd_card_rwlock); |
@@ -524,7 +524,8 @@ int __init snd_card_info_init(void) | |||
524 | snd_info_entry_t *entry; | 524 | snd_info_entry_t *entry; |
525 | 525 | ||
526 | entry = snd_info_create_module_entry(THIS_MODULE, "cards", NULL); | 526 | entry = snd_info_create_module_entry(THIS_MODULE, "cards", NULL); |
527 | snd_runtime_check(entry != NULL, return -ENOMEM); | 527 | if (! entry) |
528 | return -ENOMEM; | ||
528 | entry->c.text.read_size = PAGE_SIZE; | 529 | entry->c.text.read_size = PAGE_SIZE; |
529 | entry->c.text.read = snd_card_info_read; | 530 | entry->c.text.read = snd_card_info_read; |
530 | if (snd_info_register(entry) < 0) { | 531 | if (snd_info_register(entry) < 0) { |
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index 69e1059112d1..b2497cec2079 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c | |||
@@ -521,9 +521,13 @@ static void snd_mixer_oss_get_volume1_vol(snd_mixer_oss_file_t *fmixer, | |||
521 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); | 521 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
522 | if (uinfo == NULL || uctl == NULL) | 522 | if (uinfo == NULL || uctl == NULL) |
523 | goto __unalloc; | 523 | goto __unalloc; |
524 | snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); | 524 | if (kctl->info(kctl, uinfo)) |
525 | snd_runtime_check(!kctl->get(kctl, uctl), goto __unalloc); | 525 | goto __unalloc; |
526 | snd_runtime_check(uinfo->type != SNDRV_CTL_ELEM_TYPE_BOOLEAN || uinfo->value.integer.min != 0 || uinfo->value.integer.max != 1, goto __unalloc); | 526 | if (kctl->get(kctl, uctl)) |
527 | goto __unalloc; | ||
528 | if (uinfo->type == SNDRV_CTL_ELEM_TYPE_BOOLEAN && | ||
529 | uinfo->value.integer.min == 0 && uinfo->value.integer.max == 1) | ||
530 | goto __unalloc; | ||
527 | *left = snd_mixer_oss_conv1(uctl->value.integer.value[0], uinfo->value.integer.min, uinfo->value.integer.max, &pslot->volume[0]); | 531 | *left = snd_mixer_oss_conv1(uctl->value.integer.value[0], uinfo->value.integer.min, uinfo->value.integer.max, &pslot->volume[0]); |
528 | if (uinfo->count > 1) | 532 | if (uinfo->count > 1) |
529 | *right = snd_mixer_oss_conv1(uctl->value.integer.value[1], uinfo->value.integer.min, uinfo->value.integer.max, &pslot->volume[1]); | 533 | *right = snd_mixer_oss_conv1(uctl->value.integer.value[1], uinfo->value.integer.min, uinfo->value.integer.max, &pslot->volume[1]); |
@@ -555,8 +559,10 @@ static void snd_mixer_oss_get_volume1_sw(snd_mixer_oss_file_t *fmixer, | |||
555 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); | 559 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
556 | if (uinfo == NULL || uctl == NULL) | 560 | if (uinfo == NULL || uctl == NULL) |
557 | goto __unalloc; | 561 | goto __unalloc; |
558 | snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); | 562 | if (kctl->info(kctl, uinfo)) |
559 | snd_runtime_check(!kctl->get(kctl, uctl), goto __unalloc); | 563 | goto __unalloc; |
564 | if (kctl->get(kctl, uctl)) | ||
565 | goto __unalloc; | ||
560 | if (!uctl->value.integer.value[0]) { | 566 | if (!uctl->value.integer.value[0]) { |
561 | *left = 0; | 567 | *left = 0; |
562 | if (uinfo->count == 1) | 568 | if (uinfo->count == 1) |
@@ -616,12 +622,16 @@ static void snd_mixer_oss_put_volume1_vol(snd_mixer_oss_file_t *fmixer, | |||
616 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); | 622 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
617 | if (uinfo == NULL || uctl == NULL) | 623 | if (uinfo == NULL || uctl == NULL) |
618 | goto __unalloc; | 624 | goto __unalloc; |
619 | snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); | 625 | if (kctl->info(kctl, uinfo)) |
620 | snd_runtime_check(uinfo->type != SNDRV_CTL_ELEM_TYPE_BOOLEAN || uinfo->value.integer.min != 0 || uinfo->value.integer.max != 1, goto __unalloc); | 626 | goto __unalloc; |
627 | if (uinfo->type == SNDRV_CTL_ELEM_TYPE_BOOLEAN && | ||
628 | uinfo->value.integer.min == 0 && uinfo->value.integer.max == 1) | ||
629 | goto __unalloc; | ||
621 | uctl->value.integer.value[0] = snd_mixer_oss_conv2(left, uinfo->value.integer.min, uinfo->value.integer.max); | 630 | uctl->value.integer.value[0] = snd_mixer_oss_conv2(left, uinfo->value.integer.min, uinfo->value.integer.max); |
622 | if (uinfo->count > 1) | 631 | if (uinfo->count > 1) |
623 | uctl->value.integer.value[1] = snd_mixer_oss_conv2(right, uinfo->value.integer.min, uinfo->value.integer.max); | 632 | uctl->value.integer.value[1] = snd_mixer_oss_conv2(right, uinfo->value.integer.min, uinfo->value.integer.max); |
624 | snd_runtime_check((res = kctl->put(kctl, uctl)) >= 0, goto __unalloc); | 633 | if ((res = kctl->put(kctl, uctl)) < 0) |
634 | goto __unalloc; | ||
625 | if (res > 0) | 635 | if (res > 0) |
626 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); | 636 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); |
627 | __unalloc: | 637 | __unalloc: |
@@ -653,7 +663,8 @@ static void snd_mixer_oss_put_volume1_sw(snd_mixer_oss_file_t *fmixer, | |||
653 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); | 663 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
654 | if (uinfo == NULL || uctl == NULL) | 664 | if (uinfo == NULL || uctl == NULL) |
655 | goto __unalloc; | 665 | goto __unalloc; |
656 | snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); | 666 | if (kctl->info(kctl, uinfo)) |
667 | goto __unalloc; | ||
657 | if (uinfo->count > 1) { | 668 | if (uinfo->count > 1) { |
658 | uctl->value.integer.value[0] = left > 0 ? 1 : 0; | 669 | uctl->value.integer.value[0] = left > 0 ? 1 : 0; |
659 | uctl->value.integer.value[route ? 3 : 1] = right > 0 ? 1 : 0; | 670 | uctl->value.integer.value[route ? 3 : 1] = right > 0 ? 1 : 0; |
@@ -664,7 +675,8 @@ static void snd_mixer_oss_put_volume1_sw(snd_mixer_oss_file_t *fmixer, | |||
664 | } else { | 675 | } else { |
665 | uctl->value.integer.value[0] = (left > 0 || right > 0) ? 1 : 0; | 676 | uctl->value.integer.value[0] = (left > 0 || right > 0) ? 1 : 0; |
666 | } | 677 | } |
667 | snd_runtime_check((res = kctl->put(kctl, uctl)) >= 0, goto __unalloc); | 678 | if ((res = kctl->put(kctl, uctl)) < 0) |
679 | goto __unalloc; | ||
668 | if (res > 0) | 680 | if (res > 0) |
669 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); | 681 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); |
670 | __unalloc: | 682 | __unalloc: |
@@ -776,9 +788,14 @@ static int snd_mixer_oss_get_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int | |||
776 | } | 788 | } |
777 | down_read(&card->controls_rwsem); | 789 | down_read(&card->controls_rwsem); |
778 | kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); | 790 | kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); |
779 | snd_runtime_check(kctl != NULL, err = -ENOENT; goto __unlock); | 791 | if (! kctl) { |
780 | snd_runtime_check(!(err = kctl->info(kctl, uinfo)), goto __unlock); | 792 | err = -ENOENT; |
781 | snd_runtime_check(!(err = kctl->get(kctl, uctl)), goto __unlock); | 793 | goto __unlock; |
794 | } | ||
795 | if ((err = kctl->info(kctl, uinfo)) < 0) | ||
796 | goto __unlock; | ||
797 | if ((err = kctl->get(kctl, uctl)) < 0) | ||
798 | goto __unlock; | ||
782 | for (idx = 0; idx < 32; idx++) { | 799 | for (idx = 0; idx < 32; idx++) { |
783 | if (!(mixer->mask_recsrc & (1 << idx))) | 800 | if (!(mixer->mask_recsrc & (1 << idx))) |
784 | continue; | 801 | continue; |
@@ -821,8 +838,12 @@ static int snd_mixer_oss_put_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int | |||
821 | } | 838 | } |
822 | down_read(&card->controls_rwsem); | 839 | down_read(&card->controls_rwsem); |
823 | kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); | 840 | kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); |
824 | snd_runtime_check(kctl != NULL, err = -ENOENT; goto __unlock); | 841 | if (! kctl) { |
825 | snd_runtime_check(!(err = kctl->info(kctl, uinfo)), goto __unlock); | 842 | err = -ENOENT; |
843 | goto __unlock; | ||
844 | } | ||
845 | if ((err = kctl->info(kctl, uinfo)) < 0) | ||
846 | goto __unlock; | ||
826 | for (idx = 0; idx < 32; idx++) { | 847 | for (idx = 0; idx < 32; idx++) { |
827 | if (!(mixer->mask_recsrc & (1 << idx))) | 848 | if (!(mixer->mask_recsrc & (1 << idx))) |
828 | continue; | 849 | continue; |
@@ -836,10 +857,11 @@ static int snd_mixer_oss_put_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int | |||
836 | break; | 857 | break; |
837 | slot = NULL; | 858 | slot = NULL; |
838 | } | 859 | } |
839 | snd_runtime_check(slot != NULL, goto __unlock); | 860 | if (! slot) |
861 | goto __unlock; | ||
840 | for (idx = 0; idx < uinfo->count; idx++) | 862 | for (idx = 0; idx < uinfo->count; idx++) |
841 | uctl->value.enumerated.item[idx] = slot->capture_item; | 863 | uctl->value.enumerated.item[idx] = slot->capture_item; |
842 | snd_runtime_check((err = kctl->put(kctl, uctl)) >= 0, ); | 864 | err = kctl->put(kctl, uctl); |
843 | if (err > 0) | 865 | if (err > 0) |
844 | snd_ctl_notify(fmixer->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); | 866 | snd_ctl_notify(fmixer->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); |
845 | err = 0; | 867 | err = 0; |
@@ -1008,7 +1030,8 @@ static int snd_mixer_oss_build_input(snd_mixer_oss_t *mixer, struct snd_mixer_os | |||
1008 | up_read(&mixer->card->controls_rwsem); | 1030 | up_read(&mixer->card->controls_rwsem); |
1009 | if (slot.present != 0) { | 1031 | if (slot.present != 0) { |
1010 | pslot = (struct slot *)kmalloc(sizeof(slot), GFP_KERNEL); | 1032 | pslot = (struct slot *)kmalloc(sizeof(slot), GFP_KERNEL); |
1011 | snd_runtime_check(pslot != NULL, return -ENOMEM); | 1033 | if (! pslot) |
1034 | return -ENOMEM; | ||
1012 | *pslot = slot; | 1035 | *pslot = slot; |
1013 | pslot->signature = SNDRV_MIXER_OSS_SIGNATURE; | 1036 | pslot->signature = SNDRV_MIXER_OSS_SIGNATURE; |
1014 | pslot->assigned = ptr; | 1037 | pslot->assigned = ptr; |
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 1be470e942ef..184e74b75ba9 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -273,7 +273,8 @@ static void snd_pcm_proc_info_read(snd_pcm_substream_t *substream, snd_info_buff | |||
273 | snd_pcm_info_t *info; | 273 | snd_pcm_info_t *info; |
274 | int err; | 274 | int err; |
275 | 275 | ||
276 | snd_runtime_check(substream, return); | 276 | if (! substream) |
277 | return; | ||
277 | 278 | ||
278 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 279 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
279 | if (! info) { | 280 | if (! info) { |
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 0503980c23d9..dfc5f45f2748 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -156,9 +156,8 @@ static inline snd_pcm_uframes_t snd_pcm_update_hw_ptr_pos(snd_pcm_substream_t *s | |||
156 | #ifdef CONFIG_SND_DEBUG | 156 | #ifdef CONFIG_SND_DEBUG |
157 | if (pos >= runtime->buffer_size) { | 157 | if (pos >= runtime->buffer_size) { |
158 | snd_printk(KERN_ERR "BUG: stream = %i, pos = 0x%lx, buffer size = 0x%lx, period size = 0x%lx\n", substream->stream, pos, runtime->buffer_size, runtime->period_size); | 158 | snd_printk(KERN_ERR "BUG: stream = %i, pos = 0x%lx, buffer size = 0x%lx, period size = 0x%lx\n", substream->stream, pos, runtime->buffer_size, runtime->period_size); |
159 | } else | 159 | } |
160 | #endif | 160 | #endif |
161 | snd_runtime_check(pos < runtime->buffer_size, return 0); | ||
162 | pos -= pos % runtime->min_align; | 161 | pos -= pos % runtime->min_align; |
163 | return pos; | 162 | return pos; |
164 | } | 163 | } |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index e97b2d162cc7..e6e2b70314c0 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -2053,7 +2053,8 @@ static int snd_pcm_open(struct inode *inode, struct file *file) | |||
2053 | snd_pcm_file_t *pcm_file; | 2053 | snd_pcm_file_t *pcm_file; |
2054 | wait_queue_t wait; | 2054 | wait_queue_t wait; |
2055 | 2055 | ||
2056 | snd_runtime_check(device >= SNDRV_MINOR_PCM_PLAYBACK && device < SNDRV_MINOR_DEVICES, return -ENXIO); | 2056 | if (device < SNDRV_MINOR_PCM_PLAYBACK || device >= SNDRV_MINOR_DEVICES) |
2057 | return -ENXIO; | ||
2057 | pcm = snd_pcm_devices[(cardnum * SNDRV_PCM_DEVICES) + (device % SNDRV_MINOR_PCMS)]; | 2058 | pcm = snd_pcm_devices[(cardnum * SNDRV_PCM_DEVICES) + (device % SNDRV_MINOR_PCMS)]; |
2058 | if (pcm == NULL) { | 2059 | if (pcm == NULL) { |
2059 | err = -ENODEV; | 2060 | err = -ENODEV; |
diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c index b4674ae3bc30..f89f40f44876 100644 --- a/sound/core/seq/seq_midi.c +++ b/sound/core/seq/seq_midi.c | |||
@@ -449,11 +449,9 @@ snd_seq_midisynth_unregister_port(snd_seq_device_t *dev) | |||
449 | client->ports_per_device[device] = 0; | 449 | client->ports_per_device[device] = 0; |
450 | msynth = client->ports[device]; | 450 | msynth = client->ports[device]; |
451 | client->ports[device] = NULL; | 451 | client->ports[device] = NULL; |
452 | snd_runtime_check(msynth != NULL || ports <= 0, goto __skip); | ||
453 | for (p = 0; p < ports; p++) | 452 | for (p = 0; p < ports; p++) |
454 | snd_seq_midisynth_delete(&msynth[p]); | 453 | snd_seq_midisynth_delete(&msynth[p]); |
455 | kfree(msynth); | 454 | kfree(msynth); |
456 | __skip: | ||
457 | client->num_ports--; | 455 | client->num_ports--; |
458 | if (client->num_ports <= 0) { | 456 | if (client->num_ports <= 0) { |
459 | snd_seq_delete_kernel_client(client->seq_client); | 457 | snd_seq_delete_kernel_client(client->seq_client); |
diff --git a/sound/core/timer.c b/sound/core/timer.c index 22b104624084..128916c66085 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c | |||
@@ -879,7 +879,8 @@ void snd_timer_notify(snd_timer_t *timer, enum sndrv_timer_event event, struct t | |||
879 | snd_timer_instance_t *ti, *ts; | 879 | snd_timer_instance_t *ti, *ts; |
880 | struct list_head *p, *n; | 880 | struct list_head *p, *n; |
881 | 881 | ||
882 | snd_runtime_check(timer->hw.flags & SNDRV_TIMER_HW_SLAVE, return); | 882 | if (! (timer->hw.flags & SNDRV_TIMER_HW_SLAVE)) |
883 | return; | ||
883 | snd_assert(event >= SNDRV_TIMER_EVENT_MSTART && event <= SNDRV_TIMER_EVENT_MRESUME, return); | 884 | snd_assert(event >= SNDRV_TIMER_EVENT_MSTART && event <= SNDRV_TIMER_EVENT_MRESUME, return); |
884 | spin_lock_irqsave(&timer->lock, flags); | 885 | spin_lock_irqsave(&timer->lock, flags); |
885 | if (event == SNDRV_TIMER_EVENT_MSTART || | 886 | if (event == SNDRV_TIMER_EVENT_MSTART || |