From c1f0ec46b42b9b375d8a4ed54ac4478538310a6d Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Sun, 13 Jun 2021 09:18:39 -0700 Subject: [PATCH] topology: pre-process-object: dont create if section already exists Skip creating section when it exists already. Signed-off-by: Ranjani Sridharan Signed-off-by: Jaroslav Kysela --- topology/pre-process-object.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/topology/pre-process-object.c b/topology/pre-process-object.c index e476946..c5a132b 100644 --- a/topology/pre-process-object.c +++ b/topology/pre-process-object.c @@ -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; -- 2.47.1