alsa/0009-ucm-Do-not-fail-to-parse-configs-on-cards-with-an-em.patch
Takashi Iwai 1848bd6c60 Accepting request 758564 from home:tiwai:branches:multimedia:libs
- Upstream fixes, including the alsa-tools build breakage:
  0001-ucm-Use-strncmp-to-avoid-access-out-of-boundary.patch
  0002-ucm-return-always-at-least-NULL-if-no-list-is-availa.patch
  0003-ucm-add-_identifiers-list.patch
  0004-namehint-correct-the-args-check.patch
  0005-namehint-improve-the-previous-patch-check-the-return.patch
  0006-ucm-docs-allow-spaces-in-device-names-for-JackHWMute.patch
  0007-use-case-docs-add-PlaybackMixerCopy-and-CaptureMixer.patch
  0008-ucm-docs-add-JackCTL-rearrange-JackControl-and-JackD.patch
  0009-ucm-Do-not-fail-to-parse-configs-on-cards-with-an-em.patch
  0010-src-ucm-main.c-fix-build-without-mixer.patch
  0011-alsa.m4-another-try-to-fix-the-libatopology-detectio.patch
  0012-ucm-docs-add-Mic-DigitalMic-and-multiple-devices-com.patch
  0013-ucm-docs-remove-DigitalMic-it-does-not-have-sense.patch
  0014-ucm-docs-change-the-Mic-description-to-simple-Microp.patch
  0015-ucm-docs-add-note-about-the-sequences-and-device-spl.patch
  0016-ucm-docs-remove-MixerCopy-values-add-Priority-for-ve.patch
  0017-ucm-setup-conf_format-after-getting-ALSA_CONFIG_UCM_.patch
  0018-alsa-lib-fix-the-array-parser-unique-compound-keys.patch
  0019-topology-remove-vendor_fd-name-from-snd_tplg-structu.patch
  0020-topology-file-position-and-size-cleanups.patch
  0021-topology-use-an-array-describing-blocks-for-the-main.patch
  0022-topology-use-size_t-for-calc_block_size.patch
  0023-topology-merge-write_block-to-tplg_write_data.patch
  0024-topology-make-vebose-output-more-nice.patch
  0025-topology-use-list_insert-macro-in-tplg_elem_insert.patch
  0026-topology-dapm-coding-fixes.patch
  0027-topology-dapm-merge-identical-index-blocks-like-for-.patch
  0028-topology-more-coding-fixes.patch
  0029-Fix-alsa-sound-.h-for-external-programs.patch

OBS-URL: https://build.opensuse.org/request/show/758564
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=263
2019-12-20 16:28:33 +00:00

84 lines
3.0 KiB
Diff

From e59034a0bec257cc7422a1e9436d936be8696a6f Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 3 Dec 2019 18:27:39 +0100
Subject: [PATCH 09/30] ucm: Do not fail to parse configs on cards with an
empty CardComponents lists
Since the UCM profiles for all Bay- and Cherry-Trail SST cards have been
moved over to UCM2, parsing them fails with:
ALSA lib ucm_subs.c:220:(uc_mgr_get_substituted_value) variable '${CardComponents}' is not defined in this context!
This completely breaks audio support on all Bay- and Cherry-Trail devices.
This is caused by these non-SOF ASoC using cards having an empty
CardComponents list. Which in itself is fine, but is rejected by
the ucm_subs.c code. This commit changes the ucm_subs code to accept
an empty string as a valid value for CardComponents restoring audio
functionality on these boards.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/ucm/ucm_subs.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/ucm/ucm_subs.c b/src/ucm/ucm_subs.c
index 00afa9e3de0e..90e395f0ab6f 100644
--- a/src/ucm/ucm_subs.c
+++ b/src/ucm/ucm_subs.c
@@ -25,6 +25,7 @@
*/
#include "ucm_local.h"
+#include <stdbool.h>
#include <sys/stat.h>
#include <limits.h>
@@ -145,10 +146,11 @@ static char *rval_sysfs(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED, const char
return strdup(path);
}
-#define MATCH_VARIABLE(name, id, fcn) \
+#define MATCH_VARIABLE(name, id, fcn, empty_ok) \
if (strncmp((name), (id), sizeof(id) - 1) == 0) { \
rval = fcn(uc_mgr); \
idsize = sizeof(id) - 1; \
+ allow_empty = (empty_ok); \
goto __rval; \
}
@@ -189,12 +191,14 @@ int uc_mgr_get_substituted_value(snd_use_case_mgr_t *uc_mgr,
while (*value) {
if (*value == '$' && *(value+1) == '{') {
- MATCH_VARIABLE(value, "${ConfName}", rval_conf_name);
- MATCH_VARIABLE(value, "${CardId}", rval_card_id);
- MATCH_VARIABLE(value, "${CardDriver}", rval_card_driver);
- MATCH_VARIABLE(value, "${CardName}", rval_card_name);
- MATCH_VARIABLE(value, "${CardLongName}", rval_card_longname);
- MATCH_VARIABLE(value, "${CardComponents}", rval_card_components);
+ bool allow_empty = false;
+
+ MATCH_VARIABLE(value, "${ConfName}", rval_conf_name, false);
+ MATCH_VARIABLE(value, "${CardId}", rval_card_id, false);
+ MATCH_VARIABLE(value, "${CardDriver}", rval_card_driver, false);
+ MATCH_VARIABLE(value, "${CardName}", rval_card_name, false);
+ MATCH_VARIABLE(value, "${CardLongName}", rval_card_longname, false);
+ MATCH_VARIABLE(value, "${CardComponents}", rval_card_components, true);
MATCH_VARIABLE2(value, "${env:", rval_env);
MATCH_VARIABLE2(value, "${sys:", rval_sysfs);
err = -EINVAL;
@@ -208,7 +212,7 @@ int uc_mgr_get_substituted_value(snd_use_case_mgr_t *uc_mgr,
}
goto __error;
__rval:
- if (rval == NULL || rval[0] == '\0') {
+ if (rval == NULL || (!allow_empty && rval[0] == '\0')) {
free(rval);
strncpy(r, value, idsize);
r[idsize] = '\0';
--
2.16.4