ASoC: core: Fail probe if we fail to add dai widgets
PATCH 1/1 ASoC: core: Fail probe if we fail to add dai widgets
Signed-off-by Nariman Poushin <[email protected]>
--- sound/soc/soc-core.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
sound/soc/soc-core.c +9 -2
@@ -1132,8 +1132,15 @@ static int soc_probe_codec(struct snd_soc_card *card, driver->num_dapm_widgets);/* Create DAPM widgets for each DAI stream */ -list_for_each_entry (dai, &codec->component.dai_list, list) -snd_soc_dapm_new_dai_widgets (&codec->dapm, dai); +list_for_each_entry (dai, &codec->component.dai_list, list) { + ret =snd_soc_dapm_new_dai_widgets (&codec->dapm, dai); + +if (ret !=0 ) { +dev_err (codec->dev, +"Failed to create DAI widgets %d\n" , ret); + goto err_probe; + } + } codec->dapm.idle_bias_off = driver->idle_bias_off;
Signature · 1 line
1.8.5.3
Mark Brown
maintainerQuoted 1 line · Nariman Poushin
Signed-off-by Nariman Poushin <[email protected]>
So, I've applied this on the basis that it'll at least print an error but...
sound/soc/soc-core.c static int soc_probe_codec(struct snd_soc_card *card, · line 1143
Quoted 9 lines
sound/soc/soc-core.c +9
-0+list_for_each_entry (dai, &codec->component.dai_list, list) { + ret =snd_soc_dapm_new_dai_widgets (&codec->dapm, dai); + +if (ret !=0 ) { +dev_err (codec->dev, +"Failed to create DAI widgets %d\n" , ret); + goto err_probe; + } + }
...this doesn't actually do any cleanup of the widgets that were added if the failure isn't the first one in the loop (which is a prexisting bug with the handling of errors on probe()). We're also not checking the _new_controls() immediately before (but again, that's a prexisting bug).