diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 11:44:01 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:28:58 -0500 |
commit | 73e77ba0235532bd7523ba90883d325f6e095acf (patch) | |
tree | d22f29805ade9e78bd5f1802590d42f6e121c3c1 /sound/core | |
parent | 00a4e3d9f8df8a90966b75d517154718b4a2242a (diff) |
[ALSA] Add error messages
Add error messages in the critial error path to be more verbose.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/control.c | 8 | ||||
-rw-r--r-- | sound/core/device.c | 5 | ||||
-rw-r--r-- | sound/core/hwdep.c | 7 | ||||
-rw-r--r-- | sound/core/pcm.c | 16 | ||||
-rw-r--r-- | sound/core/rawmidi.c | 18 | ||||
-rw-r--r-- | sound/core/timer.c | 4 |
6 files changed, 42 insertions, 16 deletions
diff --git a/sound/core/control.c b/sound/core/control.c index 03ae9bb7d38e..f8f98cc52417 100644 --- a/sound/core/control.c +++ b/sound/core/control.c | |||
@@ -195,8 +195,10 @@ struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol *control, unsigned int acce | |||
195 | snd_assert(control != NULL, return NULL); | 195 | snd_assert(control != NULL, return NULL); |
196 | snd_assert(control->count > 0, return NULL); | 196 | snd_assert(control->count > 0, return NULL); |
197 | kctl = kzalloc(sizeof(*kctl) + sizeof(struct snd_kcontrol_volatile) * control->count, GFP_KERNEL); | 197 | kctl = kzalloc(sizeof(*kctl) + sizeof(struct snd_kcontrol_volatile) * control->count, GFP_KERNEL); |
198 | if (kctl == NULL) | 198 | if (kctl == NULL) { |
199 | snd_printk(KERN_ERR "Cannot allocate control instance\n"); | ||
199 | return NULL; | 200 | return NULL; |
201 | } | ||
200 | *kctl = *control; | 202 | *kctl = *control; |
201 | for (idx = 0; idx < kctl->count; idx++) | 203 | for (idx = 0; idx < kctl->count; idx++) |
202 | kctl->vd[idx].access = access; | 204 | kctl->vd[idx].access = access; |
@@ -309,7 +311,9 @@ int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol) | |||
309 | struct snd_ctl_elem_id id; | 311 | struct snd_ctl_elem_id id; |
310 | unsigned int idx; | 312 | unsigned int idx; |
311 | 313 | ||
312 | snd_assert(card != NULL && kcontrol != NULL, return -EINVAL); | 314 | snd_assert(card != NULL, return -EINVAL); |
315 | if (! kcontrol) | ||
316 | return -EINVAL; | ||
313 | snd_assert(kcontrol->info != NULL, return -EINVAL); | 317 | snd_assert(kcontrol->info != NULL, return -EINVAL); |
314 | id = kcontrol->id; | 318 | id = kcontrol->id; |
315 | down_write(&card->controls_rwsem); | 319 | down_write(&card->controls_rwsem); |
diff --git a/sound/core/device.c b/sound/core/device.c index afa8cc7fb05e..b1cf6ec56784 100644 --- a/sound/core/device.c +++ b/sound/core/device.c | |||
@@ -50,8 +50,10 @@ int snd_device_new(struct snd_card *card, snd_device_type_t type, | |||
50 | snd_assert(device_data != NULL, return -ENXIO); | 50 | snd_assert(device_data != NULL, return -ENXIO); |
51 | snd_assert(ops != NULL, return -ENXIO); | 51 | snd_assert(ops != NULL, return -ENXIO); |
52 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | 52 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
53 | if (dev == NULL) | 53 | if (dev == NULL) { |
54 | snd_printk(KERN_ERR "Cannot allocate device\n"); | ||
54 | return -ENOMEM; | 55 | return -ENOMEM; |
56 | } | ||
55 | dev->card = card; | 57 | dev->card = card; |
56 | dev->type = type; | 58 | dev->type = type; |
57 | dev->state = SNDRV_DEV_BUILD; | 59 | dev->state = SNDRV_DEV_BUILD; |
@@ -173,6 +175,7 @@ int snd_device_register(struct snd_card *card, void *device_data) | |||
173 | dev->state = SNDRV_DEV_REGISTERED; | 175 | dev->state = SNDRV_DEV_REGISTERED; |
174 | return 0; | 176 | return 0; |
175 | } | 177 | } |
178 | snd_printd("snd_device_register busy\n"); | ||
176 | return -EBUSY; | 179 | return -EBUSY; |
177 | } | 180 | } |
178 | snd_BUG(); | 181 | snd_BUG(); |
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index da0fb9f08413..444e266e7c48 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c | |||
@@ -364,13 +364,14 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device, | |||
364 | *rhwdep = NULL; | 364 | *rhwdep = NULL; |
365 | snd_assert(card != NULL, return -ENXIO); | 365 | snd_assert(card != NULL, return -ENXIO); |
366 | hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL); | 366 | hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL); |
367 | if (hwdep == NULL) | 367 | if (hwdep == NULL) { |
368 | snd_printk(KERN_ERR "hwdep: cannot allocate\n"); | ||
368 | return -ENOMEM; | 369 | return -ENOMEM; |
370 | } | ||
369 | hwdep->card = card; | 371 | hwdep->card = card; |
370 | hwdep->device = device; | 372 | hwdep->device = device; |
371 | if (id) { | 373 | if (id) |
372 | strlcpy(hwdep->id, id, sizeof(hwdep->id)); | 374 | strlcpy(hwdep->id, id, sizeof(hwdep->id)); |
373 | } | ||
374 | #ifdef CONFIG_SND_OSSEMUL | 375 | #ifdef CONFIG_SND_OSSEMUL |
375 | hwdep->oss_type = -1; | 376 | hwdep->oss_type = -1; |
376 | #endif | 377 | #endif |
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 59c995bbf15b..9305ac357a3e 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -600,14 +600,18 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) | |||
600 | pstr->reg = &snd_pcm_reg[stream]; | 600 | pstr->reg = &snd_pcm_reg[stream]; |
601 | if (substream_count > 0) { | 601 | if (substream_count > 0) { |
602 | err = snd_pcm_stream_proc_init(pstr); | 602 | err = snd_pcm_stream_proc_init(pstr); |
603 | if (err < 0) | 603 | if (err < 0) { |
604 | snd_printk(KERN_ERR "Error in snd_pcm_stream_proc_init\n"); | ||
604 | return err; | 605 | return err; |
606 | } | ||
605 | } | 607 | } |
606 | prev = NULL; | 608 | prev = NULL; |
607 | for (idx = 0, prev = NULL; idx < substream_count; idx++) { | 609 | for (idx = 0, prev = NULL; idx < substream_count; idx++) { |
608 | substream = kzalloc(sizeof(*substream), GFP_KERNEL); | 610 | substream = kzalloc(sizeof(*substream), GFP_KERNEL); |
609 | if (substream == NULL) | 611 | if (substream == NULL) { |
612 | snd_printk(KERN_ERR "Cannot allocate PCM substream\n"); | ||
610 | return -ENOMEM; | 613 | return -ENOMEM; |
614 | } | ||
611 | substream->pcm = pcm; | 615 | substream->pcm = pcm; |
612 | substream->pstr = pstr; | 616 | substream->pstr = pstr; |
613 | substream->number = idx; | 617 | substream->number = idx; |
@@ -620,6 +624,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) | |||
620 | prev->next = substream; | 624 | prev->next = substream; |
621 | err = snd_pcm_substream_proc_init(substream); | 625 | err = snd_pcm_substream_proc_init(substream); |
622 | if (err < 0) { | 626 | if (err < 0) { |
627 | snd_printk(KERN_ERR "Error in snd_pcm_stream_proc_init\n"); | ||
623 | kfree(substream); | 628 | kfree(substream); |
624 | return err; | 629 | return err; |
625 | } | 630 | } |
@@ -666,13 +671,14 @@ int snd_pcm_new(struct snd_card *card, char *id, int device, | |||
666 | *rpcm = NULL; | 671 | *rpcm = NULL; |
667 | snd_assert(card != NULL, return -ENXIO); | 672 | snd_assert(card != NULL, return -ENXIO); |
668 | pcm = kzalloc(sizeof(*pcm), GFP_KERNEL); | 673 | pcm = kzalloc(sizeof(*pcm), GFP_KERNEL); |
669 | if (pcm == NULL) | 674 | if (pcm == NULL) { |
675 | snd_printk(KERN_ERR "Cannot allocate PCM\n"); | ||
670 | return -ENOMEM; | 676 | return -ENOMEM; |
677 | } | ||
671 | pcm->card = card; | 678 | pcm->card = card; |
672 | pcm->device = device; | 679 | pcm->device = device; |
673 | if (id) { | 680 | if (id) |
674 | strlcpy(pcm->id, id, sizeof(pcm->id)); | 681 | strlcpy(pcm->id, id, sizeof(pcm->id)); |
675 | } | ||
676 | if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, playback_count)) < 0) { | 682 | if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, playback_count)) < 0) { |
677 | snd_pcm_free(pcm); | 683 | snd_pcm_free(pcm); |
678 | return err; | 684 | return err; |
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index ede0a6083d29..7a86a9a08a15 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c | |||
@@ -1382,8 +1382,10 @@ static int snd_rawmidi_alloc_substreams(struct snd_rawmidi *rmidi, | |||
1382 | INIT_LIST_HEAD(&stream->substreams); | 1382 | INIT_LIST_HEAD(&stream->substreams); |
1383 | for (idx = 0; idx < count; idx++) { | 1383 | for (idx = 0; idx < count; idx++) { |
1384 | substream = kzalloc(sizeof(*substream), GFP_KERNEL); | 1384 | substream = kzalloc(sizeof(*substream), GFP_KERNEL); |
1385 | if (substream == NULL) | 1385 | if (substream == NULL) { |
1386 | snd_printk(KERN_ERR "rawmidi: cannot allocate substream\n"); | ||
1386 | return -ENOMEM; | 1387 | return -ENOMEM; |
1388 | } | ||
1387 | substream->stream = direction; | 1389 | substream->stream = direction; |
1388 | substream->number = idx; | 1390 | substream->number = idx; |
1389 | substream->rmidi = rmidi; | 1391 | substream->rmidi = rmidi; |
@@ -1425,19 +1427,27 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device, | |||
1425 | *rrawmidi = NULL; | 1427 | *rrawmidi = NULL; |
1426 | snd_assert(card != NULL, return -ENXIO); | 1428 | snd_assert(card != NULL, return -ENXIO); |
1427 | rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL); | 1429 | rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL); |
1428 | if (rmidi == NULL) | 1430 | if (rmidi == NULL) { |
1431 | snd_printk(KERN_ERR "rawmidi: cannot allocate\n"); | ||
1429 | return -ENOMEM; | 1432 | return -ENOMEM; |
1433 | } | ||
1430 | rmidi->card = card; | 1434 | rmidi->card = card; |
1431 | rmidi->device = device; | 1435 | rmidi->device = device; |
1432 | init_MUTEX(&rmidi->open_mutex); | 1436 | init_MUTEX(&rmidi->open_mutex); |
1433 | init_waitqueue_head(&rmidi->open_wait); | 1437 | init_waitqueue_head(&rmidi->open_wait); |
1434 | if (id != NULL) | 1438 | if (id != NULL) |
1435 | strlcpy(rmidi->id, id, sizeof(rmidi->id)); | 1439 | strlcpy(rmidi->id, id, sizeof(rmidi->id)); |
1436 | if ((err = snd_rawmidi_alloc_substreams(rmidi, &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT], SNDRV_RAWMIDI_STREAM_INPUT, input_count)) < 0) { | 1440 | if ((err = snd_rawmidi_alloc_substreams(rmidi, |
1441 | &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT], | ||
1442 | SNDRV_RAWMIDI_STREAM_INPUT, | ||
1443 | input_count)) < 0) { | ||
1437 | snd_rawmidi_free(rmidi); | 1444 | snd_rawmidi_free(rmidi); |
1438 | return err; | 1445 | return err; |
1439 | } | 1446 | } |
1440 | if ((err = snd_rawmidi_alloc_substreams(rmidi, &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT], SNDRV_RAWMIDI_STREAM_OUTPUT, output_count)) < 0) { | 1447 | if ((err = snd_rawmidi_alloc_substreams(rmidi, |
1448 | &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT], | ||
1449 | SNDRV_RAWMIDI_STREAM_OUTPUT, | ||
1450 | output_count)) < 0) { | ||
1441 | snd_rawmidi_free(rmidi); | 1451 | snd_rawmidi_free(rmidi); |
1442 | return err; | 1452 | return err; |
1443 | } | 1453 | } |
diff --git a/sound/core/timer.c b/sound/core/timer.c index 18d43a037850..74637cef6d2c 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c | |||
@@ -777,8 +777,10 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid, | |||
777 | snd_assert(rtimer != NULL, return -EINVAL); | 777 | snd_assert(rtimer != NULL, return -EINVAL); |
778 | *rtimer = NULL; | 778 | *rtimer = NULL; |
779 | timer = kzalloc(sizeof(*timer), GFP_KERNEL); | 779 | timer = kzalloc(sizeof(*timer), GFP_KERNEL); |
780 | if (timer == NULL) | 780 | if (timer == NULL) { |
781 | snd_printk(KERN_ERR "timer: cannot allocate\n"); | ||
781 | return -ENOMEM; | 782 | return -ENOMEM; |
783 | } | ||
782 | timer->tmr_class = tid->dev_class; | 784 | timer->tmr_class = tid->dev_class; |
783 | timer->card = card; | 785 | timer->card = card; |
784 | timer->tmr_device = tid->device; | 786 | timer->tmr_device = tid->device; |