File 0005-Revert-conf-fix-load_for_all_cards-do-not-merge-the-.patch of Package alsa

From 2ef8952b46a46b97a6df2f29bcd182f895ebf9e4 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Wed, 10 Dec 2025 12:03:29 +0100
Subject: [PATCH 5/7] Revert "conf: fix load_for_all_cards() - do not merge the
 card specific contents"

This reverts commit eda76146c5653ff1d5bc4b4c53f7a2d5ccc17da2.

Also, revert additional related commits:

  Revert "conf: fix possible memory leak in config_file_open() - error path"
  This reverts commit 2f59398c83b8065fb9ff58939df3a9187746068e.

  Revert "conf: merge card specific contents per file (whole) after parsing"
  This reverts commit a6238053c4fa518b214f99d91a01b96c5ef6e3ca.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
 src/conf.c | 42 ++++++++++++------------------------------
 1 file changed, 12 insertions(+), 30 deletions(-)

diff --git a/src/conf.c b/src/conf.c
index d90f6dc35d3b..fb9f0658a816 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -4116,27 +4116,14 @@ static int config_filename_filter(const struct dirent64 *dirent)
 	return 0;
 }
 
-static int config_file_open(snd_config_t *root, const char *filename, int merge)
+static int config_file_open(snd_config_t *root, const char *filename)
 {
 	snd_input_t *in;
-	snd_config_t *top;
 	int err;
 
 	err = snd_input_stdio_open(&in, filename, "r");
 	if (err >= 0) {
-		if (merge) {
-			err = snd_config_load(root, in);
-		} else {
-			err = snd_config_top(&top);
-			if (err >= 0) {
-				err = snd_config_load(top, in);
-				if (err >= 0) {
-					err = snd_config_merge(root, top, 1);
-					if (err < 0)
-						snd_config_delete(top);
-				}
-			}
-		}
+		err = snd_config_load(root, in);
 		snd_input_close(in);
 		if (err < 0)
 			snd_error(CORE, "%s may be old or corrupted: consider to remove or fix it", filename);
@@ -4146,7 +4133,7 @@ static int config_file_open(snd_config_t *root, const char *filename, int merge)
 	return err;
 }
 
-static int config_file_load(snd_config_t *root, const char *fn, int errors, int merge)
+static int config_file_load(snd_config_t *root, const char *fn, int errors)
 {
 	struct stat64 st;
 	struct dirent64 **namelist;
@@ -4159,7 +4146,7 @@ static int config_file_load(snd_config_t *root, const char *fn, int errors, int
 		return 1;
 	}
 	if (!S_ISDIR(st.st_mode))
-		return config_file_open(root, fn, merge);
+		return config_file_open(root, fn);
 #ifndef DOC_HIDDEN
 #if defined(_GNU_SOURCE) && \
     !defined(__NetBSD__) && \
@@ -4185,7 +4172,7 @@ static int config_file_load(snd_config_t *root, const char *fn, int errors, int
 				snprintf(filename, sl, "%s/%s", fn, namelist[j]->d_name);
 				filename[sl-1] = '\0';
 
-				err = config_file_open(root, filename, merge);
+				err = config_file_open(root, filename);
 				free(filename);
 			}
 			free(namelist[j]);
@@ -4197,20 +4184,20 @@ static int config_file_load(snd_config_t *root, const char *fn, int errors, int
 	return 0;
 }
 
-static int config_file_load_user(snd_config_t *root, const char *fn, int errors, int merge)
+static int config_file_load_user(snd_config_t *root, const char *fn, int errors)
 {
 	char *fn2;
 	int err;
 
 	err = snd_user_file(fn, &fn2);
 	if (err < 0)
-		return config_file_load(root, fn, errors, merge);
-	err = config_file_load(root, fn2, errors, merge);
+		return config_file_load(root, fn, errors);
+	err = config_file_load(root, fn2, errors);
 	free(fn2);
 	return err;
 }
 
-static int config_file_load_user_all(snd_config_t *_root, snd_config_t *_file, int errors, int merge)
+static int config_file_load_user_all(snd_config_t *_root, snd_config_t *_file, int errors)
 {
 	snd_config_t *file = _file, *root = _root, *n;
 	char *name, *name2, *remain, *rname = NULL;
@@ -4241,7 +4228,7 @@ static int config_file_load_user_all(snd_config_t *_root, snd_config_t *_file, i
 			*remain = '\0';
 			remain += 3;
 		}
-		err = config_file_load_user(root, name2, errors, merge);
+		err = config_file_load_user(root, name2, errors);
 		if (err < 0)
 			goto _err;
 		if (err == 0)	/* first hit wins */
@@ -4290,7 +4277,7 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t
 {
 	snd_config_t *n;
 	snd_config_iterator_t i, next;
-	int err, idx = 0, errors = 1, merge = 1, hit;
+	int err, idx = 0, errors = 1, hit;
 
 	assert(root && dst);
 	if ((err = snd_config_search(config, "errors", &n)) >= 0) {
@@ -4300,10 +4287,6 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t
 			return errors;
 		}
 	}
-	/* special case, we know the card number (may be multiple times) */
-	if (private_data && snd_config_search(private_data, "integer", &n) >= 0) {
-		merge = 0;
-	}
 	if ((err = snd_config_search(config, "files", &n)) < 0) {
 		snd_error(CORE, "Unable to find field files in the pre-load section");
 		return -EINVAL;
@@ -4316,7 +4299,6 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t
 		snd_error(CORE, "Invalid type for field filenames");
 		goto _err;
 	}
-
 	do {
 		hit = 0;
 		snd_config_for_each(i, next, n) {
@@ -4330,7 +4312,7 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t
 				goto _err;
 			}
 			if (i == idx) {
-				err = config_file_load_user_all(root, n, errors, merge);
+				err = config_file_load_user_all(root, n, errors);
 				if (err < 0)
 					goto _err;
 				idx++;
-- 
2.52.0

openSUSE Build Service is sponsored by