]> git.alsa-project.org Git - alsa-utils.git/commitdiff
topology: pre-process-object: dont create if section already exists
authorRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Sun, 13 Jun 2021 16:18:39 +0000 (09:18 -0700)
committerJaroslav Kysela <perex@perex.cz>
Mon, 23 Aug 2021 14:49:56 +0000 (16:49 +0200)
Skip creating section when it exists already.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
topology/pre-process-object.c

index e4769464cab72e5495f40de02c0c145745e186e9..c5a132b9ef5aa6813daa96c2182a3fd75a95cca6 100644 (file)
@@ -880,16 +880,18 @@ int tplg_build_object_from_template(struct tplg_pre_processor *tplg_pp, snd_conf
                *wtop = top;
        } else {
                *wtop = tplg_find_config(top, object_name);
-               if (!(*wtop)) {
-                       ret = tplg_config_make_add(wtop, object_name, SND_CONFIG_TYPE_COMPOUND,
-                                                  top);
-                       if (ret < 0) {
-                               SNDERR("Error creating config for %s\n", object_name);
-                               return ret;
-                       }
+               if (*wtop)
+                       goto template;
+
+               ret = tplg_config_make_add(wtop, object_name, SND_CONFIG_TYPE_COMPOUND,
+                                          top);
+               if (ret < 0) {
+                       SNDERR("Error creating config for %s\n", object_name);
+                       return ret;
                }
        }
 
+template:
        /* create template config */
        if (!map->template_items)
                return 0;