From: Takashi Iwai Subject: Re: [PATCH] topology: Fix issue in parsing routes when generating topology binary Date: Fri, 05 May 2017 09:25:07 +0200 Message-ID: References: <1493967122-13036-1-git-send-email-fuweix.tang@intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 5B4D42668C9 for ; Fri, 5 May 2017 09:25:07 +0200 (CEST) In-Reply-To: <1493967122-13036-1-git-send-email-fuweix.tang@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: fuweix.tang@intel.com Cc: liam.r.girdwood@linux.intel.com, mengdong.lin@intel.com, alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org On Fri, 05 May 2017 08:52:02 +0200, fuweix.tang@intel.com wrote: > > From: Fuwei Tang > > 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 > Tested-by: Subhransu S. Prusty > --- > src/topology/dapm.c | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) > > diff --git a/src/topology/dapm.c b/src/topology/dapm.c > index 13aa1c4..2fa387f 100644 > --- a/src/topology/dapm.c > +++ b/src/topology/dapm.c > @@ -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; This function should return an error code. Takashi