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 | |
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>
-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 | ||||
-rw-r--r-- | sound/drivers/mpu401/mpu401_uart.c | 1 | ||||
-rw-r--r-- | sound/drivers/opl3/opl3_lib.c | 4 | ||||
-rw-r--r-- | sound/isa/opl3sa2.c | 27 |
9 files changed, 66 insertions, 24 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; |
diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c index 16e87f31788c..ee67b522d259 100644 --- a/sound/drivers/mpu401/mpu401_uart.c +++ b/sound/drivers/mpu401/mpu401_uart.c | |||
@@ -462,6 +462,7 @@ int snd_mpu401_uart_new(struct snd_card *card, int device, | |||
462 | return err; | 462 | return err; |
463 | mpu = kzalloc(sizeof(*mpu), GFP_KERNEL); | 463 | mpu = kzalloc(sizeof(*mpu), GFP_KERNEL); |
464 | if (mpu == NULL) { | 464 | if (mpu == NULL) { |
465 | snd_printk(KERN_ERR "mpu401_uart: cannot allocate\n"); | ||
465 | snd_device_free(card, rmidi); | 466 | snd_device_free(card, rmidi); |
466 | return -ENOMEM; | 467 | return -ENOMEM; |
467 | } | 468 | } |
diff --git a/sound/drivers/opl3/opl3_lib.c b/sound/drivers/opl3/opl3_lib.c index cbd37e919601..650f3b8e60e0 100644 --- a/sound/drivers/opl3/opl3_lib.c +++ b/sound/drivers/opl3/opl3_lib.c | |||
@@ -349,8 +349,10 @@ int snd_opl3_new(struct snd_card *card, | |||
349 | 349 | ||
350 | *ropl3 = NULL; | 350 | *ropl3 = NULL; |
351 | opl3 = kzalloc(sizeof(*opl3), GFP_KERNEL); | 351 | opl3 = kzalloc(sizeof(*opl3), GFP_KERNEL); |
352 | if (opl3 == NULL) | 352 | if (opl3 == NULL) { |
353 | snd_printk(KERN_ERR "opl3: cannot allocate\n"); | ||
353 | return -ENOMEM; | 354 | return -ENOMEM; |
355 | } | ||
354 | 356 | ||
355 | opl3->card = card; | 357 | opl3->card = card; |
356 | opl3->hardware = hardware; | 358 | opl3->hardware = hardware; |
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index b923de9b321d..aafe5565b6e5 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c | |||
@@ -496,21 +496,29 @@ static int __init snd_opl3sa2_mixer(struct snd_opl3sa2 *chip) | |||
496 | /* reassign AUX0 to CD */ | 496 | /* reassign AUX0 to CD */ |
497 | strcpy(id1.name, "Aux Playback Switch"); | 497 | strcpy(id1.name, "Aux Playback Switch"); |
498 | strcpy(id2.name, "CD Playback Switch"); | 498 | strcpy(id2.name, "CD Playback Switch"); |
499 | if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) | 499 | if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) { |
500 | snd_printk(KERN_ERR "Cannot rename opl3sa2 control\n"); | ||
500 | return err; | 501 | return err; |
502 | } | ||
501 | strcpy(id1.name, "Aux Playback Volume"); | 503 | strcpy(id1.name, "Aux Playback Volume"); |
502 | strcpy(id2.name, "CD Playback Volume"); | 504 | strcpy(id2.name, "CD Playback Volume"); |
503 | if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) | 505 | if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) { |
506 | snd_printk(KERN_ERR "Cannot rename opl3sa2 control\n"); | ||
504 | return err; | 507 | return err; |
508 | } | ||
505 | /* reassign AUX1 to FM */ | 509 | /* reassign AUX1 to FM */ |
506 | strcpy(id1.name, "Aux Playback Switch"); id1.index = 1; | 510 | strcpy(id1.name, "Aux Playback Switch"); id1.index = 1; |
507 | strcpy(id2.name, "FM Playback Switch"); | 511 | strcpy(id2.name, "FM Playback Switch"); |
508 | if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) | 512 | if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) { |
513 | snd_printk(KERN_ERR "Cannot rename opl3sa2 control\n"); | ||
509 | return err; | 514 | return err; |
515 | } | ||
510 | strcpy(id1.name, "Aux Playback Volume"); | 516 | strcpy(id1.name, "Aux Playback Volume"); |
511 | strcpy(id2.name, "FM Playback Volume"); | 517 | strcpy(id2.name, "FM Playback Volume"); |
512 | if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) | 518 | if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) { |
519 | snd_printk(KERN_ERR "Cannot rename opl3sa2 control\n"); | ||
513 | return err; | 520 | return err; |
521 | } | ||
514 | /* add OPL3SA2 controls */ | 522 | /* add OPL3SA2 controls */ |
515 | for (idx = 0; idx < ARRAY_SIZE(snd_opl3sa2_controls); idx++) { | 523 | for (idx = 0; idx < ARRAY_SIZE(snd_opl3sa2_controls); idx++) { |
516 | if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_opl3sa2_controls[idx], chip))) < 0) | 524 | if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_opl3sa2_controls[idx], chip))) < 0) |
@@ -575,8 +583,10 @@ static int __init snd_opl3sa2_pnp(int dev, struct snd_opl3sa2 *chip, | |||
575 | int err; | 583 | int err; |
576 | 584 | ||
577 | cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL); | 585 | cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL); |
578 | if (!cfg) | 586 | if (!cfg) { |
587 | snd_printk(KERN_ERR PFX "cannot allocate pnp cfg\n"); | ||
579 | return -ENOMEM; | 588 | return -ENOMEM; |
589 | } | ||
580 | /* PnP initialization */ | 590 | /* PnP initialization */ |
581 | pnp_init_resource_table(cfg); | 591 | pnp_init_resource_table(cfg); |
582 | if (sb_port[dev] != SNDRV_AUTO_PORT) | 592 | if (sb_port[dev] != SNDRV_AUTO_PORT) |
@@ -597,7 +607,7 @@ static int __init snd_opl3sa2_pnp(int dev, struct snd_opl3sa2 *chip, | |||
597 | pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1); | 607 | pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1); |
598 | err = pnp_manual_config_dev(pdev, cfg, 0); | 608 | err = pnp_manual_config_dev(pdev, cfg, 0); |
599 | if (err < 0) | 609 | if (err < 0) |
600 | snd_printk(KERN_ERR "PnP manual resources are invalid, using auto config\n"); | 610 | snd_printk(KERN_WARNING "PnP manual resources are invalid, using auto config\n"); |
601 | err = pnp_activate_dev(pdev); | 611 | err = pnp_activate_dev(pdev); |
602 | if (err < 0) { | 612 | if (err < 0) { |
603 | kfree(cfg); | 613 | kfree(cfg); |
@@ -784,8 +794,11 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard, | |||
784 | struct snd_card *card; | 794 | struct snd_card *card; |
785 | 795 | ||
786 | pdev = pnp_request_card_device(pcard, id->devs[0].id, NULL); | 796 | pdev = pnp_request_card_device(pcard, id->devs[0].id, NULL); |
787 | if (pdev == NULL) | 797 | if (pdev == NULL) { |
798 | snd_printk(KERN_ERR PFX "can't get pnp device from id '%s'\n", | ||
799 | id->devs[0].id); | ||
788 | return -EBUSY; | 800 | return -EBUSY; |
801 | } | ||
789 | for (; dev < SNDRV_CARDS; dev++) { | 802 | for (; dev < SNDRV_CARDS; dev++) { |
790 | if (enable[dev] && isapnp[dev]) | 803 | if (enable[dev] && isapnp[dev]) |
791 | break; | 804 | break; |