From: Kuninori Morimoto Date: Fri, 8 Mar 2013 01:42:33 +0000 (-0800) Subject: ASoC: core: remove codec from list if registration failed X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=e1328a832c7eeeb4dd3c3666605717c555de9e83;p=openwrt%2Fstaging%2Fblogic.git ASoC: core: remove codec from list if registration failed Current snd_soc_register_codec() adds codec to list, and calls snd_soc_register_dais(). But, this listed codec should be removed if dais registration was failed. Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e02c374d2243..0ce075c47b25 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -4096,6 +4096,10 @@ int snd_soc_register_codec(struct device *dev, return 0; fail_codec_name: + mutex_lock(&client_mutex); + list_del(&codec->list); + mutex_unlock(&client_mutex); + kfree(codec->name); fail_codec: kfree(codec);