From: Nariman Poushin Date: Tue, 1 Apr 2014 12:59:33 +0000 (+0100) Subject: ASoC: core: Fail codec probe if we fail to add controls X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=b318ad503698160183fe5e0752b9a1bb3e558026;p=linux-beck.git ASoC: core: Fail codec probe if we fail to add controls Signed-off-by: Nariman Poushin Signed-off-by: Mark Brown --- diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index d5710fc79b49..777453158347 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -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) {