aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs
diff options
context:
space:
mode:
authorLiam Girdwood <lg@opensource.wolfsonmicro.com>2007-01-31 04:02:23 -0500
committerJaroslav Kysela <perex@suse.cz>2007-02-09 03:03:22 -0500
commite35115a58856ced315cb8f75df56e9b9a816e70a (patch)
tree7aa86aba3c4ed36271ca46d82bf98481a84f901f /sound/soc/codecs
parent877b866d86786ac69d3d939905999fe7fe1e23fd (diff)
[ALSA] ASoC codec error reporting
This patch improves the codec probe() error reporting by printing error messages when the card or pcms fail to register. Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r--sound/soc/codecs/wm8731.c15
-rw-r--r--sound/soc/codecs/wm8750.c14
-rw-r--r--sound/soc/codecs/wm9712.c22
3 files changed, 34 insertions, 17 deletions
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index 8151b45a280c..9956d654b6f3 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -696,8 +696,8 @@ static int wm8731_init(struct snd_soc_device *socdev)
696 /* register pcms */ 696 /* register pcms */
697 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); 697 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
698 if (ret < 0) { 698 if (ret < 0) {
699 kfree(codec->reg_cache); 699 printk(KERN_ERR "wm8731: failed to create pcms\n");
700 return ret; 700 goto pcm_err;
701 } 701 }
702 702
703 /* power on device */ 703 /* power on device */
@@ -717,11 +717,18 @@ static int wm8731_init(struct snd_soc_device *socdev)
717 wm8731_add_widgets(codec); 717 wm8731_add_widgets(codec);
718 ret = snd_soc_register_card(socdev); 718 ret = snd_soc_register_card(socdev);
719 if (ret < 0) { 719 if (ret < 0) {
720 snd_soc_free_pcms(socdev); 720 printk(KERN_ERR "wm8731: failed to register card\n");
721 snd_soc_dapm_free(socdev); 721 goto card_err;
722 } 722 }
723 723
724 return ret; 724 return ret;
725
726card_err:
727 snd_soc_free_pcms(socdev);
728 snd_soc_dapm_free(socdev);
729pcm_err:
730 kfree(codec->reg_cache);
731 return ret;
725} 732}
726 733
727static struct snd_soc_device *wm8731_socdev; 734static struct snd_soc_device *wm8731_socdev;
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c
index e7f04b89c8a0..d4a288ba644b 100644
--- a/sound/soc/codecs/wm8750.c
+++ b/sound/soc/codecs/wm8750.c
@@ -1075,8 +1075,8 @@ static int wm8750_init(struct snd_soc_device *socdev)
1075 /* register pcms */ 1075 /* register pcms */
1076 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); 1076 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
1077 if (ret < 0) { 1077 if (ret < 0) {
1078 kfree(codec->reg_cache); 1078 printk(KERN_ERR "wm8750: failed to create pcms\n");
1079 return ret; 1079 goto pcm_err;
1080 } 1080 }
1081 1081
1082 /* charge output caps */ 1082 /* charge output caps */
@@ -1106,10 +1106,16 @@ static int wm8750_init(struct snd_soc_device *socdev)
1106 wm8750_add_widgets(codec); 1106 wm8750_add_widgets(codec);
1107 ret = snd_soc_register_card(socdev); 1107 ret = snd_soc_register_card(socdev);
1108 if (ret < 0) { 1108 if (ret < 0) {
1109 snd_soc_free_pcms(socdev); 1109 printk(KERN_ERR "wm8750: failed to register card\n");
1110 snd_soc_dapm_free(socdev); 1110 goto card_err;
1111 } 1111 }
1112 return ret;
1112 1113
1114card_err:
1115 snd_soc_free_pcms(socdev);
1116 snd_soc_dapm_free(socdev);
1117pcm_err:
1118 kfree(codec->reg_cache);
1113 return ret; 1119 return ret;
1114} 1120}
1115 1121
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
index 36c6a38a0f94..b2d2d03b9544 100644
--- a/sound/soc/codecs/wm9712.c
+++ b/sound/soc/codecs/wm9712.c
@@ -692,10 +692,8 @@ static int wm9712_soc_probe(struct platform_device *pdev)
692 codec->reg_cache = 692 codec->reg_cache =
693 kzalloc(sizeof(u16) * ARRAY_SIZE(wm9712_reg), GFP_KERNEL); 693 kzalloc(sizeof(u16) * ARRAY_SIZE(wm9712_reg), GFP_KERNEL);
694 if (codec->reg_cache == NULL) { 694 if (codec->reg_cache == NULL) {
695 kfree(codec->ac97); 695 ret = -ENOMEM;
696 kfree(socdev->codec); 696 goto cache_err;
697 socdev->codec = NULL;
698 return -ENOMEM;
699 } 697 }
700 memcpy(codec->reg_cache, wm9712_reg, sizeof(u16) * ARRAY_SIZE(wm9712_reg)); 698 memcpy(codec->reg_cache, wm9712_reg, sizeof(u16) * ARRAY_SIZE(wm9712_reg));
701 codec->reg_cache_size = sizeof(u16) * ARRAY_SIZE(wm9712_reg); 699 codec->reg_cache_size = sizeof(u16) * ARRAY_SIZE(wm9712_reg);
@@ -712,8 +710,10 @@ static int wm9712_soc_probe(struct platform_device *pdev)
712 INIT_LIST_HEAD(&codec->dapm_paths); 710 INIT_LIST_HEAD(&codec->dapm_paths);
713 711
714 ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0); 712 ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0);
715 if (ret < 0) 713 if (ret < 0) {
716 goto err; 714 printk(KERN_ERR "wm9712: failed to register AC97 codec\n");
715 goto codec_err;
716 }
717 717
718 /* register pcms */ 718 /* register pcms */
719 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); 719 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
@@ -733,8 +733,10 @@ static int wm9712_soc_probe(struct platform_device *pdev)
733 wm9712_add_controls(codec); 733 wm9712_add_controls(codec);
734 wm9712_add_widgets(codec); 734 wm9712_add_widgets(codec);
735 ret = snd_soc_register_card(socdev); 735 ret = snd_soc_register_card(socdev);
736 if (ret < 0) 736 if (ret < 0) {
737 printk(KERN_ERR "wm9712: failed to register card\n");
737 goto reset_err; 738 goto reset_err;
739 }
738 740
739 return 0; 741 return 0;
740 742
@@ -744,8 +746,10 @@ reset_err:
744pcm_err: 746pcm_err:
745 snd_soc_free_ac97_codec(codec); 747 snd_soc_free_ac97_codec(codec);
746 748
747err: 749codec_err:
748 kfree(socdev->codec->reg_cache); 750 kfree(codec->reg_cache);
751
752cache_err:
749 kfree(socdev->codec); 753 kfree(socdev->codec);
750 socdev->codec = NULL; 754 socdev->codec = NULL;
751 return ret; 755 return ret;