diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-07-05 11:29:39 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-07-05 11:29:39 -0400 |
commit | 5420f30723122012c7bb868a55ff21c7d383b68e (patch) | |
tree | b4643861067268ee4f616033f415c50cf2954128 | |
parent | 1a01417e85846e42e939a345a294e8ae2287cc1f (diff) |
ASoC: Fix leaks in WM8988 registration error handling
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | sound/soc/codecs/wm8988.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c index 03fac6a0f805..6f15acd10489 100644 --- a/sound/soc/codecs/wm8988.c +++ b/sound/soc/codecs/wm8988.c | |||
@@ -902,7 +902,7 @@ static int wm8988_register(struct wm8988_priv *wm8988) | |||
902 | ret = wm8988_reset(codec); | 902 | ret = wm8988_reset(codec); |
903 | if (ret < 0) { | 903 | if (ret < 0) { |
904 | dev_err(codec->dev, "Failed to issue reset\n"); | 904 | dev_err(codec->dev, "Failed to issue reset\n"); |
905 | return ret; | 905 | goto err; |
906 | } | 906 | } |
907 | 907 | ||
908 | /* set the update bits (we always update left then right) */ | 908 | /* set the update bits (we always update left then right) */ |
@@ -926,18 +926,20 @@ static int wm8988_register(struct wm8988_priv *wm8988) | |||
926 | ret = snd_soc_register_codec(codec); | 926 | ret = snd_soc_register_codec(codec); |
927 | if (ret != 0) { | 927 | if (ret != 0) { |
928 | dev_err(codec->dev, "Failed to register codec: %d\n", ret); | 928 | dev_err(codec->dev, "Failed to register codec: %d\n", ret); |
929 | return ret; | 929 | goto err; |
930 | } | 930 | } |
931 | 931 | ||
932 | ret = snd_soc_register_dai(&wm8988_dai); | 932 | ret = snd_soc_register_dai(&wm8988_dai); |
933 | if (ret != 0) { | 933 | if (ret != 0) { |
934 | dev_err(codec->dev, "Failed to register DAI: %d\n", ret); | 934 | dev_err(codec->dev, "Failed to register DAI: %d\n", ret); |
935 | snd_soc_unregister_codec(codec); | 935 | snd_soc_unregister_codec(codec); |
936 | return ret; | 936 | goto err_codec; |
937 | } | 937 | } |
938 | 938 | ||
939 | return 0; | 939 | return 0; |
940 | 940 | ||
941 | err_codec: | ||
942 | snd_soc_unregister_codec(codec); | ||
941 | err: | 943 | err: |
942 | kfree(wm8988); | 944 | kfree(wm8988); |
943 | return ret; | 945 | return ret; |