ASoC: soc-core: defer card registration if codec component is missing
authorJerome Brunet <jbrunet@baylibre.com>
Thu, 27 Jun 2019 12:13:49 +0000 (14:13 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 28 Jun 2019 12:40:58 +0000 (13:40 +0100)
Like cpus and platforms, defer sound card initialization if the codec
component is missing when initializing the dai_link

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-core.c

index 05cd710273b6f4f5075396b9f16a46b1451d9164..b5f3c09311c37e17af1964e0a5c9bc78837b7c26 100644 (file)
@@ -1071,12 +1071,20 @@ static int soc_init_dai_link(struct snd_soc_card *card,
                                link->name);
                        return -EINVAL;
                }
+
                /* Codec DAI name must be specified */
                if (!codec->dai_name) {
                        dev_err(card->dev, "ASoC: codec_dai_name not set for %s\n",
                                link->name);
                        return -EINVAL;
                }
+
+               /*
+                * Defer card registration if codec component is not added to
+                * component list.
+                */
+               if (!soc_find_component(codec))
+                       return -EPROBE_DEFER;
        }
 
        /*