Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Piotr Maziarz <piotrx.maziarz@linux.intel.com>,
	alsa-devel@alsa-project.org
Cc: cezary.rojewski@intel.com, amadeuszx.slawinski@intel.com
Subject: Re: [PATCH alsa-lib 2/8] topology: decode: Fix adding texts field to enum control
Date: Thu, 25 Jun 2020 09:24:46 -0500	[thread overview]
Message-ID: <f57d945d-909d-3e86-eeeb-44bbfaaa2cab@linux.intel.com> (raw)
In-Reply-To: <1593083026-7501-2-git-send-email-piotrx.maziarz@linux.intel.com>



On 6/25/20 6:03 AM, Piotr Maziarz wrote:
> Iterating over texts in tplg_decode_control_enum1 was an infinite loop,

that should probably be a separate fix?

> it needed to be fixed. Parsing values was removed since they are not added
> to the UML file.

What does this mean? first time I hear about UML for topology.

> Also texts are separate section and therefore it needs to be added as
> separate element.

separate patch?

> Signed-off-by: Piotr Maziarz <piotrx.maziarz@linux.intel.com>
> ---
>   src/topology/ctl.c | 19 ++++++++++++-------
>   1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/src/topology/ctl.c b/src/topology/ctl.c
> index c8c7e94..24eadc8 100644
> --- a/src/topology/ctl.c
> +++ b/src/topology/ctl.c
> @@ -1088,11 +1088,19 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl,
>   	}
>   
>   	if (enum_ctl->texts != NULL) {
> +		struct tplg_elem *texts = tplg_elem_new_common(tplg, NULL,
> +						enum_ctl->hdr.name, SND_TPLG_TYPE_TEXT);
> +
> +		texts->texts->num_items = num_items;
>   		for (i = 0; i < num_items; i++) {
> -			if (enum_ctl->texts[i] != NULL)
> -				snd_strlcpy(ec->texts[i], enum_ctl->texts[i],
> -					    SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
> +			if (!enum_ctl->texts[i])
> +				continue;
> +			snd_strlcpy(ec->texts[i], enum_ctl->texts[i],
> +				    SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
> +			snd_strlcpy(texts->texts->items[i], enum_ctl->texts[i],
> +				    SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
>   		}
> +		tplg_ref_add(elem, SND_TPLG_TYPE_TEXT, enum_ctl->hdr.name);
>   	}
>   
>   	if (enum_ctl->values != NULL) {
> @@ -1367,11 +1375,8 @@ int tplg_decode_control_enum1(snd_tplg_t *tplg,
>   		et->texts = tplg_calloc(heap, sizeof(char *) * ec->items);
>   		if (!et->texts)
>   			return -ENOMEM;
> -		for (i = 0; ec->items; i++) {
> -			unsigned int j = i * sizeof(int) * ENUM_VAL_SIZE;
> +		for (i = 0; i < ec->items; i++)

This is the infinite loop, this should not be buried in unrelated changes.

>   			et->texts[i] = ec->texts[i];
> -			et->values[i] = (int *)&ec->values[j];
> -		}
>   	}
>   
>   	et->map = tplg_calloc(heap, sizeof(struct snd_tplg_channel_map_template));
> 

  reply	other threads:[~2020-06-25 15:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-25 11:03 [PATCH alsa-lib 1/8] topology: decode: fix channel map memory allocation Piotr Maziarz
2020-06-25 11:03 ` [PATCH alsa-lib 2/8] topology: decode: Fix adding texts field to enum control Piotr Maziarz
2020-06-25 14:24   ` Pierre-Louis Bossart [this message]
2020-06-25 11:03 ` [PATCH alsa-lib 3/8] topology: decode: Fix printing texts section Piotr Maziarz
2020-06-25 11:03 ` [PATCH alsa-lib 4/8] topology: decode: Change declaration of enum decoding function Piotr Maziarz
2020-06-25 11:03 ` [PATCH alsa-lib 5/8] topology: decode: Fix decoding PCM formats and rates Piotr Maziarz
2020-06-25 11:03 ` [PATCH alsa-lib 6/8] topology: decode: Print sig_bits field in PCM capabilities section Piotr Maziarz
2020-06-25 11:03 ` [PATCH alsa-lib 7/8] topology: decode: Add DAI name printing Piotr Maziarz
2020-06-25 11:03 ` [PATCH alsa-lib 8/8] topology: Make buffer for saving dynamic size Piotr Maziarz
2020-06-25 14:31   ` Pierre-Louis Bossart
2020-07-02 15:04     ` Piotr Maziarz
2020-06-25 14:16 ` [PATCH alsa-lib 1/8] topology: decode: fix channel map memory allocation Pierre-Louis Bossart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f57d945d-909d-3e86-eeeb-44bbfaaa2cab@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amadeuszx.slawinski@intel.com \
    --cc=cezary.rojewski@intel.com \
    --cc=piotrx.maziarz@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox