ASoC: core: Fail codec probe if we fail to add controls
authorNariman Poushin <nariman@opensource.wolfsonmicro.com>
Tue, 1 Apr 2014 12:59:33 +0000 (13:59 +0100)
committerMark Brown <broonie@linaro.org>
Mon, 14 Apr 2014 16:23:38 +0000 (17:23 +0100)
Signed-off-by: Nariman Poushin <nariman@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/soc-core.c

index d5710fc79b4998c185402f6811f8dca48a3c35b9..7774531583472ce86b25fa4a72c91cb1cab59833 100644 (file)
@@ -1127,9 +1127,17 @@ static int soc_probe_codec(struct snd_soc_card *card,
 
        soc_init_codec_debugfs(codec);
 
-       if (driver->dapm_widgets)
-               snd_soc_dapm_new_controls(&codec->dapm, driver->dapm_widgets,
-                                         driver->num_dapm_widgets);
+       if (driver->dapm_widgets) {
+               ret = snd_soc_dapm_new_controls(&codec->dapm,
+                                               driver->dapm_widgets,
+                                               driver->num_dapm_widgets);
+
+               if (ret != 0) {
+                       dev_err(codec->dev,
+                               "Failed to create new controls %d\n", ret);
+                       goto err_probe;
+               }
+       }
 
        /* Create DAPM widgets for each DAI stream */
        list_for_each_entry(dai, &codec->component.dai_list, list) {