]> Git Repo - J-linux.git/commitdiff
ASoC: topology: free created components in tplg load error
authorBard liao <[email protected]>
Sun, 17 Feb 2019 13:23:47 +0000 (21:23 +0800)
committerMark Brown <[email protected]>
Mon, 18 Feb 2019 18:21:49 +0000 (18:21 +0000)
Topology resources are no longer needed if any element failed to load.

Signed-off-by: Bard liao <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
sound/soc/soc-topology.c

index fc79ec6927e385fbd85ab6182a6788daea610726..731b963b6995f6022c167fc0e921f9cf1bbf841e 100644 (file)
@@ -2487,6 +2487,7 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp,
        struct snd_soc_tplg_ops *ops, const struct firmware *fw, u32 id)
 {
        struct soc_tplg tplg;
+       int ret;
 
        /* setup parsing context */
        memset(&tplg, 0, sizeof(tplg));
@@ -2500,7 +2501,12 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp,
        tplg.bytes_ext_ops = ops->bytes_ext_ops;
        tplg.bytes_ext_ops_count = ops->bytes_ext_ops_count;
 
-       return soc_tplg_load(&tplg);
+       ret = soc_tplg_load(&tplg);
+       /* free the created components if fail to load topology */
+       if (ret)
+               snd_soc_tplg_component_remove(comp, SND_SOC_TPLG_INDEX_ALL);
+
+       return ret;
 }
 EXPORT_SYMBOL_GPL(snd_soc_tplg_component_load);
 
This page took 0.05325 seconds and 4 git commands to generate.