ASoC: soc-core: check return value of snd_soc_add_dai_link()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Wed, 7 Aug 2019 01:30:36 +0000 (10:30 +0900)
committerMark Brown <broonie@kernel.org>
Wed, 7 Aug 2019 13:25:47 +0000 (14:25 +0100)
snd_soc_add_dai_link() might return error, we need to check it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k1bpahpd.wl-kuninori.morimoto.gx@renesas.com
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-core.c

index 5e6a48a0f79ec2ce97394511b22481121f16e69e..7345679d49031891384018488e44152b47bcb2f6 100644 (file)
@@ -1964,8 +1964,11 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
        }
 
        /* add predefined DAI links to the list */
-       for_each_card_prelinks(card, i, dai_link)
-               snd_soc_add_dai_link(card, dai_link);
+       for_each_card_prelinks(card, i, dai_link) {
+               ret = snd_soc_add_dai_link(card, dai_link);
+               if (ret < 0)
+                       goto probe_end;
+       }
 
        /* card bind complete so register a sound card */
        ret = snd_card_new(card->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,