diff options
author | Liam Girdwood <lg@opensource.wolfsonmicro.com> | 2007-01-31 04:02:23 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2007-02-09 03:03:22 -0500 |
commit | e35115a58856ced315cb8f75df56e9b9a816e70a (patch) | |
tree | 7aa86aba3c4ed36271ca46d82bf98481a84f901f /sound/soc/codecs/wm9712.c | |
parent | 877b866d86786ac69d3d939905999fe7fe1e23fd (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/wm9712.c')
-rw-r--r-- | sound/soc/codecs/wm9712.c | 22 |
1 files changed, 13 insertions, 9 deletions
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: | |||
744 | pcm_err: | 746 | pcm_err: |
745 | snd_soc_free_ac97_codec(codec); | 747 | snd_soc_free_ac97_codec(codec); |
746 | 748 | ||
747 | err: | 749 | codec_err: |
748 | kfree(socdev->codec->reg_cache); | 750 | kfree(codec->reg_cache); |
751 | |||
752 | cache_err: | ||
749 | kfree(socdev->codec); | 753 | kfree(socdev->codec); |
750 | socdev->codec = NULL; | 754 | socdev->codec = NULL; |
751 | return ret; | 755 | return ret; |