topology: Fix issue in parsing routes when generating topology binary
PATCH 1/1 topology: Fix issue in parsing routes when generating topology binary
From: Fuwei Tang <[email protected]>
We missed parsing the index value, which is used as a use case indicator, when processing the route objects.
This patch fixes the bug.
--- src/topology/dapm.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
src/topology/dapm.c +11 -4
@@ -381,7 +381,7 @@ done: } -static int tplg_parse_routes (snd_tplg_t *tplg,snd_config_t *cfg) +static int tplg_parse_routes (snd_tplg_t *tplg,snd_config_t *cfg,int index) {snd_config_iterator_t i, next;snd_config_t *n;
@@ -399,7 +399,7 @@ static int tplg_parse_routes(snd_tplg_t *tplg, snd_config_t *cfg) elem =tplg_elem_new_route (tplg);if (!elem)return -ENOMEM ; - + elem->index = index; line = elem->route; err =tplg_parse_line (val, line);
@@ -419,7 +419,8 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg,snd_config_iterator_t i, next;snd_config_t *n;int err; -const char *graph_id; +const char *graph_id, *val =NULL ; +int index;if (snd_config_get_type (cfg) !=SND_CONFIG_TYPE_COMPOUND ) {SNDERR ("error: compound is expected for dapm graph definition\n" );
@@ -436,8 +437,14 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg,continue ; } +if (strcmp (id,"index" ) ==0 ) { +if (snd_config_get_string (n, &val) <0 ) +return NULL ; + index =atoi (val); + } +if (strcmp (id,"lines" ) ==0 ) { - err =tplg_parse_routes (tplg, n); + err =tplg_parse_routes (tplg, n, index);if (err <0 ) {SNDERR ("error: failed to parse dapm graph %s\n" , graph_id);
Signature · 1 line
2.7.4
Quoted 47 lines · On Fri, 05 May 2017 08:52:02 +0200, [email protected] wrote:
From: Fuwei Tang <[email protected]>
We missed parsing the index value, which is used as a use case indicator, when processing the route objects.
This patch fixes the bug.
Signed-off-by Fuwei Tang <[email protected]>Tested-by Subhransu S. Prusty <[email protected]>--- src/topology/dapm.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)src/topology/dapm.c +4
-3@@ -381,7 +381,7 @@ done: } -static int tplg_parse_routes (snd_tplg_t *tplg,snd_config_t *cfg) +static int tplg_parse_routes (snd_tplg_t *tplg,snd_config_t *cfg,int index) {snd_config_iterator_t i, next;snd_config_t *n;@@ -399,7 +399,7 @@ static int tplg_parse_routes(snd_tplg_t *tplg, snd_config_t *cfg) elem =tplg_elem_new_route (tplg);if (!elem)return -ENOMEM ; - + elem->index = index; line = elem->route; err =tplg_parse_line (val, line);@@ -419,7 +419,8 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg,snd_config_iterator_t i, next;snd_config_t *n;int err; -const char *graph_id; +const char *graph_id, *val =NULL ; +int index;if (snd_config_get_type (cfg) !=SND_CONFIG_TYPE_COMPOUND ) {SNDERR ("error: compound is expected for dapm graph definition\n" );
src/topology/dapm.c int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg, · line 442
Quoted 6 lines
src/topology/dapm.c +3
-0@@ -436,8 +437,14 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg,continue ; } +if (strcmp (id,"index" ) ==0 ) { +if (snd_config_get_string (n, &val) <0 ) +return NULL ;
This function should return an error code.
Takashi
Quoted 63 lines
-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Friday, May 5, 2017 3:25 PM
To: Tang, FuweiX <[email protected]>
Cc: [email protected]; [email protected]; Lin, Mengdong <[email protected]>
Subject: Re: [PATCH] topology: Fix issue in parsing routes when generating topology binarysrc/topology/dapm.c static int tplg_parse_routes(snd_tplg_t *tplg,
Quoted 29 lines · On Fri, 05 May 2017 08:52:02 +0200, [email protected] wrote:
From: Fuwei Tang <[email protected]>
We missed parsing the index value, which is used as a use case indicator, when processing the route objects.
This patch fixes the bug.
Signed-off-by Fuwei Tang <[email protected]>Tested-by Subhransu S. Prusty <[email protected]>--- src/topology/dapm.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)src/topology/dapm.c index renamed from src/topology/dapm.c +0
-013aa1c4..2fa387f 100644
src/topology/dapm.c +2
-1@@ -381,7 +381,7 @@ done: } -static int tplg_parse_routes (snd_tplg_t *tplg,snd_config_t *cfg) +static int tplg_parse_routes (snd_tplg_t *tplg,snd_config_t *cfg,int +index) {snd_config_iterator_t i, next;snd_config_t *n;@@ -399,7 +399,7 @@ static int tplg_parse_routes(snd_tplg_t *tplg,
snd_config_t*cfg)src/topology/dapm.c int tplg_parse_dapm_graph(snd_tplg_t *tplg,
Quoted 9 lines
src/topology/dapm.c +1
-1elem =tplg_elem_new_route (tplg);if (!elem)return -ENOMEM ; - + elem->index = index; line = elem->route; err =tplg_parse_line (val, line);@@ -419,7 +419,8 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg,
snd_config_t*cfg,src/topology/dapm.c int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg,
Quoted 9 lines
src/topology/dapm.c +2
-1snd_config_iterator_t i, next;snd_config_t *n;int err; -const char *graph_id; +const char *graph_id, *val =NULL ; +int index;if (snd_config_get_type (cfg) !=SND_CONFIG_TYPE_COMPOUND ) { SNDERR("error: compound is expected for dapm graphdefinition\n");
src/topology/dapm.c int tplg_parse_dapm_graph(snd_tplg_t *tplg,
Quoted 1 line
src/topology/dapm.c +0
-0@@ -436,8 +437,14 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg,
snd_config_t*cfg,
Quoted 8 lines
src/topology/dapm.c int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg, · line 442
Quoted 6 lines
src/topology/dapm.c +3
-0continue ; } +if (strcmp (id,"index" ) ==0 ) { +if (snd_config_get_string (n, &val) <0 ) +return NULL ;This function should return an error code.
I'm sorry about that, I will do so.
Thanks
Fuwei
Quoted 3 lines
Takashi