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 | |
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>
-rw-r--r-- | Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | 33 | ||||
-rw-r--r-- | include/sound/core.h | 34 | ||||
-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 | ||||
-rw-r--r-- | sound/isa/cs423x/cs4236_lib.c | 5 | ||||
-rw-r--r-- | sound/pci/ac97/ac97_codec.c | 1 | ||||
-rw-r--r-- | sound/pci/ac97/ac97_patch.c | 3 | ||||
-rw-r--r-- | sound/pci/emu10k1/emufx.c | 34 | ||||
-rw-r--r-- | sound/pci/emu10k1/emupcm.c | 3 | ||||
-rw-r--r-- | sound/pci/trident/trident_main.c | 3 | ||||
-rw-r--r-- | sound/ppc/pmac.c | 16 |
17 files changed, 126 insertions, 102 deletions
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl index 24e85520890b..f3a2fdca9ad2 100644 --- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | |||
@@ -18,8 +18,8 @@ | |||
18 | </affiliation> | 18 | </affiliation> |
19 | </author> | 19 | </author> |
20 | 20 | ||
21 | <date>March 6, 2005</date> | 21 | <date>October 6, 2005</date> |
22 | <edition>0.3.4</edition> | 22 | <edition>0.3.5</edition> |
23 | 23 | ||
24 | <abstract> | 24 | <abstract> |
25 | <para> | 25 | <para> |
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | <legalnotice> | 31 | <legalnotice> |
32 | <para> | 32 | <para> |
33 | Copyright (c) 2002-2004 Takashi Iwai <email>tiwai@suse.de</email> | 33 | Copyright (c) 2002-2005 Takashi Iwai <email>tiwai@suse.de</email> |
34 | </para> | 34 | </para> |
35 | 35 | ||
36 | <para> | 36 | <para> |
@@ -5998,32 +5998,23 @@ struct _snd_pcm_runtime { | |||
5998 | The first argument is the expression to evaluate, and the | 5998 | The first argument is the expression to evaluate, and the |
5999 | second argument is the action if it fails. When | 5999 | second argument is the action if it fails. When |
6000 | <constant>CONFIG_SND_DEBUG</constant>, is set, it will show an | 6000 | <constant>CONFIG_SND_DEBUG</constant>, is set, it will show an |
6001 | error message such as <computeroutput>BUG? (xxx) (called from | 6001 | error message such as <computeroutput>BUG? (xxx)</computeroutput> |
6002 | yyy)</computeroutput>. When no debug flag is set, this is | 6002 | together with stack trace. |
6003 | ignored. | ||
6004 | </para> | 6003 | </para> |
6005 | </section> | ||
6006 | |||
6007 | <section id="useful-functions-snd-runtime-check"> | ||
6008 | <title><function>snd_runtime_check()</function></title> | ||
6009 | <para> | 6004 | <para> |
6010 | This macro is quite similar with | 6005 | When no debug flag is set, this macro is ignored. |
6011 | <function>snd_assert()</function>. Unlike | ||
6012 | <function>snd_assert()</function>, the expression is always | ||
6013 | evaluated regardless of | ||
6014 | <constant>CONFIG_SND_DEBUG</constant>. When | ||
6015 | <constant>CONFIG_SND_DEBUG</constant> is set, the macro will | ||
6016 | show a message like <computeroutput>ERROR (xx) (called from | ||
6017 | yyy)</computeroutput>. | ||
6018 | </para> | 6006 | </para> |
6019 | </section> | 6007 | </section> |
6020 | 6008 | ||
6021 | <section id="useful-functions-snd-bug"> | 6009 | <section id="useful-functions-snd-bug"> |
6022 | <title><function>snd_BUG()</function></title> | 6010 | <title><function>snd_BUG()</function></title> |
6023 | <para> | 6011 | <para> |
6024 | It calls <function>snd_assert(0,)</function> -- that is, just | 6012 | It shows <computeroutput>BUG?</computeroutput> message and |
6025 | prints the error message at the point. It's useful to show that | 6013 | stack trace as well as <function>snd_assert</function> at the point. |
6026 | a fatal error happens there. | 6014 | It's useful to show that a fatal error happens there. |
6015 | </para> | ||
6016 | <para> | ||
6017 | When no debug flag is set, this macro is ignored. | ||
6027 | </para> | 6018 | </para> |
6028 | </section> | 6019 | </section> |
6029 | </chapter> | 6020 | </chapter> |
diff --git a/include/sound/core.h b/include/sound/core.h index 6d971a4c4ca0..f0f54407fe5c 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
@@ -429,34 +429,24 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) | |||
429 | * When CONFIG_SND_DEBUG is not set, the expression is executed but | 429 | * When CONFIG_SND_DEBUG is not set, the expression is executed but |
430 | * not checked. | 430 | * not checked. |
431 | */ | 431 | */ |
432 | #define snd_assert(expr, args...) do {\ | 432 | #define snd_assert(expr, args...) do { \ |
433 | if (unlikely(!(expr))) { \ | 433 | if (unlikely(!(expr))) { \ |
434 | snd_printk(KERN_ERR "BUG? (%s) (called from %p)\n", __ASTRING__(expr), __builtin_return_address(0));\ | 434 | snd_printk(KERN_ERR "BUG? (%s)\n", __ASTRING__(expr)); \ |
435 | args;\ | 435 | dump_stack(); \ |
436 | }\ | 436 | args; \ |
437 | } \ | ||
437 | } while (0) | 438 | } while (0) |
438 | /** | 439 | |
439 | * snd_runtime_check - run-time assertion macro | 440 | #define snd_BUG() do { \ |
440 | * @expr: expression | 441 | snd_printk(KERN_ERR "BUG?\n"); \ |
441 | * @args...: the action | 442 | dump_stack(); \ |
442 | * | ||
443 | * This macro checks the expression in run-time and invokes the commands | ||
444 | * given in the rest arguments if the assertion is failed. | ||
445 | * Unlike snd_assert(), the action commands are executed even if | ||
446 | * CONFIG_SND_DEBUG is not set but without any error messages. | ||
447 | */ | ||
448 | #define snd_runtime_check(expr, args...) do {\ | ||
449 | if (unlikely(!(expr))) { \ | ||
450 | snd_printk(KERN_ERR "ERROR (%s) (called from %p)\n", __ASTRING__(expr), __builtin_return_address(0));\ | ||
451 | args;\ | ||
452 | }\ | ||
453 | } while (0) | 443 | } while (0) |
454 | 444 | ||
455 | #else /* !CONFIG_SND_DEBUG */ | 445 | #else /* !CONFIG_SND_DEBUG */ |
456 | 446 | ||
457 | #define snd_printd(fmt, args...) /* nothing */ | 447 | #define snd_printd(fmt, args...) /* nothing */ |
458 | #define snd_assert(expr, args...) (void)(expr) | 448 | #define snd_assert(expr, args...) (void)(expr) |
459 | #define snd_runtime_check(expr, args...) do { if (!(expr)) { args; } } while (0) | 449 | #define snd_BUG() /* nothing */ |
460 | 450 | ||
461 | #endif /* CONFIG_SND_DEBUG */ | 451 | #endif /* CONFIG_SND_DEBUG */ |
462 | 452 | ||
@@ -473,8 +463,6 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) | |||
473 | #define snd_printdd(format, args...) /* nothing */ | 463 | #define snd_printdd(format, args...) /* nothing */ |
474 | #endif | 464 | #endif |
475 | 465 | ||
476 | #define snd_BUG() snd_assert(0, ) | ||
477 | |||
478 | 466 | ||
479 | static inline void snd_timestamp_now(struct timespec *tstamp, int timespec) | 467 | static inline void snd_timestamp_now(struct timespec *tstamp, int timespec) |
480 | { | 468 | { |
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 || |
diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c index 2128d4bdef41..1adb88d5f8f4 100644 --- a/sound/isa/cs423x/cs4236_lib.c +++ b/sound/isa/cs423x/cs4236_lib.c | |||
@@ -173,7 +173,10 @@ static unsigned char divisor_to_rate_register(unsigned int divisor) | |||
173 | case 2117: return 6; | 173 | case 2117: return 6; |
174 | case 2558: return 7; | 174 | case 2558: return 7; |
175 | default: | 175 | default: |
176 | snd_runtime_check(divisor >= 21 && divisor <= 192, return 192); | 176 | if (divisor < 21 || divisor > 192) { |
177 | snd_BUG(); | ||
178 | return 192; | ||
179 | } | ||
177 | return divisor; | 180 | return divisor; |
178 | } | 181 | } |
179 | } | 182 | } |
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 56549add80a8..bbc409ae7ee9 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c | |||
@@ -1127,7 +1127,6 @@ snd_kcontrol_t *snd_ac97_cnew(const snd_kcontrol_new_t *_template, ac97_t * ac97 | |||
1127 | { | 1127 | { |
1128 | snd_kcontrol_new_t template; | 1128 | snd_kcontrol_new_t template; |
1129 | memcpy(&template, _template, sizeof(template)); | 1129 | memcpy(&template, _template, sizeof(template)); |
1130 | snd_runtime_check(!template.index, return NULL); | ||
1131 | template.index = ac97->num; | 1130 | template.index = ac97->num; |
1132 | return snd_ctl_new1(&template, ac97); | 1131 | return snd_ctl_new1(&template, ac97); |
1133 | } | 1132 | } |
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index b24beb32961e..de1c72ad2c6b 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c | |||
@@ -1460,7 +1460,8 @@ int patch_ad1881(ac97_t * ac97) | |||
1460 | codecs[1] = patch_ad1881_unchained(ac97, 1, (1<<14)); | 1460 | codecs[1] = patch_ad1881_unchained(ac97, 1, (1<<14)); |
1461 | codecs[2] = patch_ad1881_unchained(ac97, 2, (1<<13)); | 1461 | codecs[2] = patch_ad1881_unchained(ac97, 2, (1<<13)); |
1462 | 1462 | ||
1463 | snd_runtime_check(codecs[0] | codecs[1] | codecs[2], goto __end); | 1463 | if (! (codecs[0] || codecs[1] || codecs[2])) |
1464 | goto __end; | ||
1464 | 1465 | ||
1465 | for (idx = 0; idx < 3; idx++) | 1466 | for (idx = 0; idx < 3; idx++) |
1466 | if (ac97->spec.ad18xx.unchained[idx]) | 1467 | if (ac97->spec.ad18xx.unchained[idx]) |
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 20db3ac6cd61..177c4ad0f778 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c | |||
@@ -364,12 +364,18 @@ static int snd_emu10k1_gpr_ctl_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value | |||
364 | snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[i], 0, db_table[val]); | 364 | snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[i], 0, db_table[val]); |
365 | break; | 365 | break; |
366 | case EMU10K1_GPR_TRANSLATION_BASS: | 366 | case EMU10K1_GPR_TRANSLATION_BASS: |
367 | snd_runtime_check((ctl->count % 5) == 0 && (ctl->count / 5) == ctl->vcount, change = -EIO; goto __error); | 367 | if ((ctl->count % 5) != 0 || (ctl->count / 5) != ctl->vcount) { |
368 | change = -EIO; | ||
369 | goto __error; | ||
370 | } | ||
368 | for (j = 0; j < 5; j++) | 371 | for (j = 0; j < 5; j++) |
369 | snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[j * ctl->vcount + i], 0, bass_table[val][j]); | 372 | snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[j * ctl->vcount + i], 0, bass_table[val][j]); |
370 | break; | 373 | break; |
371 | case EMU10K1_GPR_TRANSLATION_TREBLE: | 374 | case EMU10K1_GPR_TRANSLATION_TREBLE: |
372 | snd_runtime_check((ctl->count % 5) == 0 && (ctl->count / 5) == ctl->vcount, change = -EIO; goto __error); | 375 | if ((ctl->count % 5) != 0 || (ctl->count / 5) != ctl->vcount) { |
376 | change = -EIO; | ||
377 | goto __error; | ||
378 | } | ||
373 | for (j = 0; j < 5; j++) | 379 | for (j = 0; j < 5; j++) |
374 | snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[j * ctl->vcount + i], 0, treble_table[val][j]); | 380 | snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[j * ctl->vcount + i], 0, treble_table[val][j]); |
375 | break; | 381 | break; |
@@ -412,8 +418,6 @@ int snd_emu10k1_fx8010_register_irq_handler(emu10k1_t *emu, | |||
412 | snd_emu10k1_fx8010_irq_t *irq; | 418 | snd_emu10k1_fx8010_irq_t *irq; |
413 | unsigned long flags; | 419 | unsigned long flags; |
414 | 420 | ||
415 | snd_runtime_check(emu, return -EINVAL); | ||
416 | snd_runtime_check(handler, return -EINVAL); | ||
417 | irq = kmalloc(sizeof(*irq), GFP_ATOMIC); | 421 | irq = kmalloc(sizeof(*irq), GFP_ATOMIC); |
418 | if (irq == NULL) | 422 | if (irq == NULL) |
419 | return -ENOMEM; | 423 | return -ENOMEM; |
@@ -442,7 +446,6 @@ int snd_emu10k1_fx8010_unregister_irq_handler(emu10k1_t *emu, | |||
442 | snd_emu10k1_fx8010_irq_t *tmp; | 446 | snd_emu10k1_fx8010_irq_t *tmp; |
443 | unsigned long flags; | 447 | unsigned long flags; |
444 | 448 | ||
445 | snd_runtime_check(irq, return -EINVAL); | ||
446 | spin_lock_irqsave(&emu->fx8010.irq_lock, flags); | 449 | spin_lock_irqsave(&emu->fx8010.irq_lock, flags); |
447 | if ((tmp = emu->fx8010.irq_handlers) == irq) { | 450 | if ((tmp = emu->fx8010.irq_handlers) == irq) { |
448 | emu->fx8010.irq_handlers = tmp->next; | 451 | emu->fx8010.irq_handlers = tmp->next; |
@@ -717,9 +720,15 @@ static int snd_emu10k1_add_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode | |||
717 | err = -EFAULT; | 720 | err = -EFAULT; |
718 | goto __error; | 721 | goto __error; |
719 | } | 722 | } |
720 | snd_runtime_check(gctl->id.iface == SNDRV_CTL_ELEM_IFACE_MIXER || | 723 | if (gctl->id.iface != SNDRV_CTL_ELEM_IFACE_MIXER && |
721 | gctl->id.iface == SNDRV_CTL_ELEM_IFACE_PCM, err = -EINVAL; goto __error); | 724 | gctl->id.iface != SNDRV_CTL_ELEM_IFACE_PCM) { |
722 | snd_runtime_check(gctl->id.name[0] != '\0', err = -EINVAL; goto __error); | 725 | err = -EINVAL; |
726 | goto __error; | ||
727 | } | ||
728 | if (! gctl->id.name[0]) { | ||
729 | err = -EINVAL; | ||
730 | goto __error; | ||
731 | } | ||
723 | ctl = snd_emu10k1_look_for_ctl(emu, &gctl->id); | 732 | ctl = snd_emu10k1_look_for_ctl(emu, &gctl->id); |
724 | memset(&knew, 0, sizeof(knew)); | 733 | memset(&knew, 0, sizeof(knew)); |
725 | knew.iface = gctl->id.iface; | 734 | knew.iface = gctl->id.iface; |
@@ -783,7 +792,8 @@ static int snd_emu10k1_del_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode | |||
783 | 792 | ||
784 | for (i = 0, _id = icode->gpr_del_controls; | 793 | for (i = 0, _id = icode->gpr_del_controls; |
785 | i < icode->gpr_del_control_count; i++, _id++) { | 794 | i < icode->gpr_del_control_count; i++, _id++) { |
786 | snd_runtime_check(copy_from_user(&id, _id, sizeof(id)) == 0, return -EFAULT); | 795 | if (copy_from_user(&id, _id, sizeof(id))) |
796 | return -EFAULT; | ||
787 | down_write(&card->controls_rwsem); | 797 | down_write(&card->controls_rwsem); |
788 | ctl = snd_emu10k1_look_for_ctl(emu, &id); | 798 | ctl = snd_emu10k1_look_for_ctl(emu, &id); |
789 | if (ctl) | 799 | if (ctl) |
@@ -2075,14 +2085,16 @@ void snd_emu10k1_free_efx(emu10k1_t *emu) | |||
2075 | #if 0 // FIXME: who use them? | 2085 | #if 0 // FIXME: who use them? |
2076 | int snd_emu10k1_fx8010_tone_control_activate(emu10k1_t *emu, int output) | 2086 | int snd_emu10k1_fx8010_tone_control_activate(emu10k1_t *emu, int output) |
2077 | { | 2087 | { |
2078 | snd_runtime_check(output >= 0 && output < 6, return -EINVAL); | 2088 | if (output < 0 || output >= 6) |
2089 | return -EINVAL; | ||
2079 | snd_emu10k1_ptr_write(emu, emu->gpr_base + 0x94 + output, 0, 1); | 2090 | snd_emu10k1_ptr_write(emu, emu->gpr_base + 0x94 + output, 0, 1); |
2080 | return 0; | 2091 | return 0; |
2081 | } | 2092 | } |
2082 | 2093 | ||
2083 | int snd_emu10k1_fx8010_tone_control_deactivate(emu10k1_t *emu, int output) | 2094 | int snd_emu10k1_fx8010_tone_control_deactivate(emu10k1_t *emu, int output) |
2084 | { | 2095 | { |
2085 | snd_runtime_check(output >= 0 && output < 6, return -EINVAL); | 2096 | if (output < 0 || output >= 6) |
2097 | return -EINVAL; | ||
2086 | snd_emu10k1_ptr_write(emu, emu->gpr_base + 0x94 + output, 0, 0); | 2098 | snd_emu10k1_ptr_write(emu, emu->gpr_base + 0x94 + output, 0, 0); |
2087 | return 0; | 2099 | return 0; |
2088 | } | 2100 | } |
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c index 66ba27afe962..bf7490dae09b 100644 --- a/sound/pci/emu10k1/emupcm.c +++ b/sound/pci/emu10k1/emupcm.c | |||
@@ -965,7 +965,8 @@ static void snd_emu10k1_pcm_mixer_notify1(emu10k1_t *emu, snd_kcontrol_t *kctl, | |||
965 | { | 965 | { |
966 | snd_ctl_elem_id_t id; | 966 | snd_ctl_elem_id_t id; |
967 | 967 | ||
968 | snd_runtime_check(kctl != NULL, return); | 968 | if (! kctl) |
969 | return; | ||
969 | if (activate) | 970 | if (activate) |
970 | kctl->vd[idx].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; | 971 | kctl->vd[idx].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; |
971 | else | 972 | else |
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index 777da9a7298b..dda62955b4fe 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c | |||
@@ -2893,7 +2893,8 @@ static void snd_trident_notify_pcm_change1(snd_card_t * card, snd_kcontrol_t *kc | |||
2893 | { | 2893 | { |
2894 | snd_ctl_elem_id_t id; | 2894 | snd_ctl_elem_id_t id; |
2895 | 2895 | ||
2896 | snd_runtime_check(kctl != NULL, return); | 2896 | if (! kctl) |
2897 | return; | ||
2897 | if (activate) | 2898 | if (activate) |
2898 | kctl->vd[num].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; | 2899 | kctl->vd[num].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; |
2899 | else | 2900 | else |
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index 392b2abd9f13..db2f1815fc30 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c | |||
@@ -220,7 +220,8 @@ static int snd_pmac_pcm_prepare(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substr | |||
220 | 220 | ||
221 | /* set up constraints */ | 221 | /* set up constraints */ |
222 | astr = snd_pmac_get_stream(chip, another_stream(rec->stream)); | 222 | astr = snd_pmac_get_stream(chip, another_stream(rec->stream)); |
223 | snd_runtime_check(astr, return -EINVAL); | 223 | if (! astr) |
224 | return -EINVAL; | ||
224 | astr->cur_freqs = 1 << rate_index; | 225 | astr->cur_freqs = 1 << rate_index; |
225 | astr->cur_formats = 1 << runtime->format; | 226 | astr->cur_formats = 1 << runtime->format; |
226 | chip->rate_index = rate_index; | 227 | chip->rate_index = rate_index; |
@@ -467,7 +468,8 @@ static int snd_pmac_hw_rule_rate(snd_pcm_hw_params_t *params, | |||
467 | pmac_stream_t *rec = snd_pmac_get_stream(chip, rule->deps[0]); | 468 | pmac_stream_t *rec = snd_pmac_get_stream(chip, rule->deps[0]); |
468 | int i, freq_table[8], num_freqs; | 469 | int i, freq_table[8], num_freqs; |
469 | 470 | ||
470 | snd_runtime_check(rec, return -EINVAL); | 471 | if (! rec) |
472 | return -EINVAL; | ||
471 | num_freqs = 0; | 473 | num_freqs = 0; |
472 | for (i = chip->num_freqs - 1; i >= 0; i--) { | 474 | for (i = chip->num_freqs - 1; i >= 0; i--) { |
473 | if (rec->cur_freqs & (1 << i)) | 475 | if (rec->cur_freqs & (1 << i)) |
@@ -484,7 +486,8 @@ static int snd_pmac_hw_rule_format(snd_pcm_hw_params_t *params, | |||
484 | pmac_t *chip = rule->private; | 486 | pmac_t *chip = rule->private; |
485 | pmac_stream_t *rec = snd_pmac_get_stream(chip, rule->deps[0]); | 487 | pmac_stream_t *rec = snd_pmac_get_stream(chip, rule->deps[0]); |
486 | 488 | ||
487 | snd_runtime_check(rec, return -EINVAL); | 489 | if (! rec) |
490 | return -EINVAL; | ||
488 | return snd_mask_refine_set(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT), | 491 | return snd_mask_refine_set(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT), |
489 | rec->cur_formats); | 492 | rec->cur_formats); |
490 | } | 493 | } |
@@ -569,7 +572,8 @@ static int snd_pmac_pcm_close(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substrea | |||
569 | snd_pmac_dma_stop(rec); | 572 | snd_pmac_dma_stop(rec); |
570 | 573 | ||
571 | astr = snd_pmac_get_stream(chip, another_stream(rec->stream)); | 574 | astr = snd_pmac_get_stream(chip, another_stream(rec->stream)); |
572 | snd_runtime_check(astr, return -EINVAL); | 575 | if (! astr) |
576 | return -EINVAL; | ||
573 | 577 | ||
574 | /* reset constraints */ | 578 | /* reset constraints */ |
575 | astr->cur_freqs = chip->freqs_ok; | 579 | astr->cur_freqs = chip->freqs_ok; |
@@ -1158,7 +1162,6 @@ int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return) | |||
1158 | .dev_free = snd_pmac_dev_free, | 1162 | .dev_free = snd_pmac_dev_free, |
1159 | }; | 1163 | }; |
1160 | 1164 | ||
1161 | snd_runtime_check(chip_return, return -EINVAL); | ||
1162 | *chip_return = NULL; | 1165 | *chip_return = NULL; |
1163 | 1166 | ||
1164 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 1167 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
@@ -1382,7 +1385,8 @@ static int snd_pmac_sleep_notify(struct pmu_sleep_notifier *self, int when) | |||
1382 | pmac_t *chip; | 1385 | pmac_t *chip; |
1383 | 1386 | ||
1384 | chip = sleeping_pmac; | 1387 | chip = sleeping_pmac; |
1385 | snd_runtime_check(chip, return 0); | 1388 | if (! chip) |
1389 | return 0; | ||
1386 | 1390 | ||
1387 | switch (when) { | 1391 | switch (when) { |
1388 | case PBOOK_SLEEP_NOW: | 1392 | case PBOOK_SLEEP_NOW: |