ASoC: core: remove codec from list if registration failed
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Fri, 8 Mar 2013 01:42:33 +0000 (17:42 -0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 12 Mar 2013 18:34:59 +0000 (18:34 +0000)
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 <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/soc-core.c

index e02c374d2243362f1710b8b109bae0a59965c298..0ce075c47b2518855ec67b66042f3df857b1dfbd 100644 (file)
@@ -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);