summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2013-04-12 13:56:58 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-04-12 13:56:58 +0100
commit56c32c751cdf4aee810b4ad537ab1d836ee8f516 (patch)
treed9a53471e7ce903d7b5eb7460f1aad7f3179bf9d /sound/soc/soc-core.c
parent54b019cbd993bb9d432a27a51a800f4981aa2f1c (diff)
parent379cf39781fdb34c75bab6ac54707bc4466f3dc4 (diff)
downloadblackbird-op-linux-56c32c751cdf4aee810b4ad537ab1d836ee8f516.tar.gz
blackbird-op-linux-56c32c751cdf4aee810b4ad537ab1d836ee8f516.zip
Merge remote-tracking branch 'asoc/topic/core' into asoc-next
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 45aa1d3a4a52..7bf21a1035ea 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3905,7 +3905,7 @@ static void snd_soc_unregister_dais(struct device *dev, size_t count)
* @platform: platform to register
*/
int snd_soc_register_platform(struct device *dev,
- struct snd_soc_platform_driver *platform_drv)
+ const struct snd_soc_platform_driver *platform_drv)
{
struct snd_soc_platform *platform;
@@ -4021,8 +4021,8 @@ int snd_soc_register_codec(struct device *dev,
/* create CODEC component name */
codec->name = fmt_single_name(dev, &codec->id);
if (codec->name == NULL) {
- kfree(codec);
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto fail_codec;
}
if (codec_drv->compress_type)
@@ -4061,7 +4061,7 @@ int snd_soc_register_codec(struct device *dev,
reg_size, GFP_KERNEL);
if (!codec->reg_def_copy) {
ret = -ENOMEM;
- goto fail;
+ goto fail_codec_name;
}
}
}
@@ -4085,18 +4085,22 @@ int snd_soc_register_codec(struct device *dev,
mutex_unlock(&client_mutex);
/* register any DAIs */
- if (num_dai) {
- ret = snd_soc_register_dais(dev, dai_drv, num_dai);
- if (ret < 0)
- dev_err(codec->dev, "ASoC: Failed to regster"
- " DAIs: %d\n", ret);
+ ret = snd_soc_register_dais(dev, dai_drv, num_dai);
+ if (ret < 0) {
+ dev_err(codec->dev, "ASoC: Failed to regster DAIs: %d\n", ret);
+ goto fail_codec_name;
}
dev_dbg(codec->dev, "ASoC: Registered codec '%s'\n", codec->name);
return 0;
-fail:
+fail_codec_name:
+ mutex_lock(&client_mutex);
+ list_del(&codec->list);
+ mutex_unlock(&client_mutex);
+
kfree(codec->name);
+fail_codec:
kfree(codec);
return ret;
}
@@ -4110,7 +4114,6 @@ EXPORT_SYMBOL_GPL(snd_soc_register_codec);
void snd_soc_unregister_codec(struct device *dev)
{
struct snd_soc_codec *codec;
- int i;
list_for_each_entry(codec, &codec_list, list) {
if (dev == codec->dev)
@@ -4119,9 +4122,7 @@ void snd_soc_unregister_codec(struct device *dev)
return;
found:
- if (codec->num_dai)
- for (i = 0; i < codec->num_dai; i++)
- snd_soc_unregister_dai(dev);
+ snd_soc_unregister_dais(dev, codec->num_dai);
mutex_lock(&client_mutex);
list_del(&codec->list);
OpenPOWER on IntegriCloud