ASoC: Fail card instantiation if DAI format setup fails
authorRicard Wanderlof <ricard.wanderlof@axis.com>
Wed, 24 Jul 2019 09:38:44 +0000 (11:38 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 24 Jul 2019 16:01:45 +0000 (17:01 +0100)
If the DAI format setup fails, there is no valid communication format
between CPU and CODEC, so fail card instantiation, rather than continue
with a card that will most likely not function properly.

Signed-off-by: Ricard Wanderlof <ricardw@axis.com>
Link: https://lore.kernel.org/r/alpine.DEB.2.20.1907241132350.6338@lnxricardw1.se.axis.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-core.c

index c0a774d0a5ff0ba67b2ea0e192cf073f2585b265..1486fb2eb9212f622698f69ddc8f9272fa0e2031 100644 (file)
@@ -1511,8 +1511,11 @@ static int soc_probe_link_dais(struct snd_soc_card *card,
                }
        }
 
-       if (dai_link->dai_fmt)
-               snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt);
+       if (dai_link->dai_fmt) {
+               ret = snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt);
+               if (ret)
+                       return ret;
+       }
 
        ret = soc_post_component_init(rtd, dai_link->name);
        if (ret)