diff options
author | Axel Lin <axel.lin@gmail.com> | 2010-07-23 01:53:54 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-08-03 02:46:41 -0400 |
commit | 116bcd9cf22c00c22402c2a2be6ef8e81289a574 (patch) | |
tree | 5fc20e23feb389da1a78ced59edd56cedf1eb6ef /sound/soc/codecs/wm9081.c | |
parent | d484366beeab0cded9644083172151c5afacc503 (diff) |
ASoC: wm9081: fix resource reclaim in wm9081_register error path
This patch fixes the error path in wm9081_register to properly free resources.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm9081.c')
-rw-r--r-- | sound/soc/codecs/wm9081.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index 13186fb4dcb4..76b37ff6c264 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c | |||
@@ -1356,7 +1356,7 @@ static int wm9081_register(struct wm9081_priv *wm9081, | |||
1356 | ret = snd_soc_codec_set_cache_io(codec, 8, 16, control); | 1356 | ret = snd_soc_codec_set_cache_io(codec, 8, 16, control); |
1357 | if (ret != 0) { | 1357 | if (ret != 0) { |
1358 | dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); | 1358 | dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); |
1359 | return ret; | 1359 | goto err; |
1360 | } | 1360 | } |
1361 | 1361 | ||
1362 | reg = snd_soc_read(codec, WM9081_SOFTWARE_RESET); | 1362 | reg = snd_soc_read(codec, WM9081_SOFTWARE_RESET); |
@@ -1369,7 +1369,7 @@ static int wm9081_register(struct wm9081_priv *wm9081, | |||
1369 | ret = wm9081_reset(codec); | 1369 | ret = wm9081_reset(codec); |
1370 | if (ret < 0) { | 1370 | if (ret < 0) { |
1371 | dev_err(codec->dev, "Failed to issue reset\n"); | 1371 | dev_err(codec->dev, "Failed to issue reset\n"); |
1372 | return ret; | 1372 | goto err; |
1373 | } | 1373 | } |
1374 | 1374 | ||
1375 | wm9081_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 1375 | wm9081_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
@@ -1388,18 +1388,19 @@ static int wm9081_register(struct wm9081_priv *wm9081, | |||
1388 | ret = snd_soc_register_codec(codec); | 1388 | ret = snd_soc_register_codec(codec); |
1389 | if (ret != 0) { | 1389 | if (ret != 0) { |
1390 | dev_err(codec->dev, "Failed to register codec: %d\n", ret); | 1390 | dev_err(codec->dev, "Failed to register codec: %d\n", ret); |
1391 | return ret; | 1391 | goto err; |
1392 | } | 1392 | } |
1393 | 1393 | ||
1394 | ret = snd_soc_register_dai(&wm9081_dai); | 1394 | ret = snd_soc_register_dai(&wm9081_dai); |
1395 | if (ret != 0) { | 1395 | if (ret != 0) { |
1396 | dev_err(codec->dev, "Failed to register DAI: %d\n", ret); | 1396 | dev_err(codec->dev, "Failed to register DAI: %d\n", ret); |
1397 | snd_soc_unregister_codec(codec); | 1397 | goto err_codec; |
1398 | return ret; | ||
1399 | } | 1398 | } |
1400 | 1399 | ||
1401 | return 0; | 1400 | return 0; |
1402 | 1401 | ||
1402 | err_codec: | ||
1403 | snd_soc_unregister_codec(codec); | ||
1403 | err: | 1404 | err: |
1404 | kfree(wm9081); | 1405 | kfree(wm9081); |
1405 | return ret; | 1406 | return ret; |