topology: Fix parsing config with multiple hw_configs
PATCH RESEND v2 1/1 topology: Fix parsing config with multiple hw_configs
Currently, if the config file includes several hw_configs sections, parse_hw_config_refs() returns after parsing only the first section.
For example, the following config, based on alsa-lib/src/conf/topology/broadwell/broadwell.conf, is parsed incorrectly:
~~~~
SectionHWConfig."CodecHWConfig" {
id "1"
format "I2S" # physical audio format.
bclk "master" # Platform is master of bit clock
fsync "master" # platform is master of fsync
}
SectionHWConfig."CodecHWConfig2" {
id "2"
format "AC97"
}SectionLink."Codec" {
# used for binding to the physical link
id "0" hw_configs [
"CodecHWConfig"
"CodecHWConfig2"
]
default_hw_conf_id "2"
}~~~~
--- src/topology/pcm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
src/topology/pcm.c +4 -1
@@ -882,6 +882,7 @@ static int parse_hw_config_refs(snd_tplg_t *tplg, snd_config_t *cfg,/* refer to a list of HW configs */ snd_config_for_each (i, next, cfg) {const char *val; +int err; n =snd_config_iterator_entry (i);if (snd_config_get_string (n, &val) <0 )
@@ -893,7 +894,9 @@ static int parse_hw_config_refs(snd_tplg_t *tplg, snd_config_t *cfg, } link->num_hw_configs++; -return tplg_ref_add (elem,SND_TPLG_TYPE_HW_CONFIG , val); + err =tplg_ref_add (elem,SND_TPLG_TYPE_HW_CONFIG , val); +if (err <0 ) +return err; }return 0 ;
Signature · 1 line
2.13.6
Jaroslav Kysela
AppliedDne 21.3.2018 v 20:08 Kirill Marinushkin napsal(a):
Quoted 2 lines
Currently, if the config file includes several
hw_configssections,parse_hw_config_refs()returns after parsing only the first section.
Applied. Thanks.
Jaroslav
Quoted 63 lines
For example, the following config, based on
alsa-lib/src/conf/topology/broadwell/broadwell.conf, is parsed incorrectly:~~~~
SectionHWConfig."CodecHWConfig" {
id "1"
format "I2S" # physical audio format.
bclk "master" # Platform is master of bit clock
fsync "master" # platform is master of fsync
}SectionHWConfig."CodecHWConfig2" { id "2" format "AC97" }SectionLink."Codec" {
# used for binding to the physical link id "0"hw_configs [ "CodecHWConfig" "CodecHWConfig2" ] default_hw_conf_id "2" }~~~~
Signed-off-by Kirill Marinushkin <[email protected]>Cc Jaroslav Kysela <[email protected]>Cc Takashi Iwai <[email protected]>--- src/topology/pcm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)src/topology/pcm.c +4
-1@@ -882,6 +882,7 @@ static int parse_hw_config_refs(snd_tplg_t *tplg, snd_config_t *cfg,/* refer to a list of HW configs */ snd_config_for_each (i, next, cfg) {const char *val; +int err; n =snd_config_iterator_entry (i);if (snd_config_get_string (n, &val) <0 )@@ -893,7 +894,9 @@ static int parse_hw_config_refs(snd_tplg_t *tplg, snd_config_t *cfg, } link->num_hw_configs++; -return tplg_ref_add (elem,SND_TPLG_TYPE_HW_CONFIG , val); + err =tplg_ref_add (elem,SND_TPLG_TYPE_HW_CONFIG , val); +if (err <0 ) +return err; }return 0 ;
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.