diff mbox series

[v2,03/10] topology: decode: Remove decoding values for enum control

Message ID 1594026363-30276-4-git-send-email-piotrx.maziarz@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series topology: decode: Various fixes | expand

Commit Message

Piotr Maziarz July 6, 2020, 9:05 a.m. UTC
Values have no representation in UCM file, therefore there is no need to
populate them. Also memory for values wasn't allocated which was causing
undefined behaviour.

Change-Id: I86b990d20808091eb61fb6710b35a0c1f1cbce10
---
 src/topology/ctl.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Pierre-Louis Bossart July 6, 2020, 7:54 p.m. UTC | #1
On 7/6/20 4:05 AM, Piotr Maziarz wrote:
> Values have no representation in UCM file, therefore there is no need to

Sorry, I don't get the logical assertion here. What is the link or 
dependency between UCM and topology?

> populate them. Also memory for values wasn't allocated which was causing
> undefined behaviour.
> 
> Change-Id: I86b990d20808091eb61fb6710b35a0c1f1cbce10
> ---
>   src/topology/ctl.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/src/topology/ctl.c b/src/topology/ctl.c
> index 0aa49ab..02e482e 100644
> --- a/src/topology/ctl.c
> +++ b/src/topology/ctl.c
> @@ -1367,11 +1367,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; i < ec->items; i++) {
> -			unsigned int j = i * sizeof(int) * ENUM_VAL_SIZE;
> +		for (i = 0; i < ec->items; i++)
>   			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));
>
diff mbox series

Patch

diff --git a/src/topology/ctl.c b/src/topology/ctl.c
index 0aa49ab..02e482e 100644
--- a/src/topology/ctl.c
+++ b/src/topology/ctl.c
@@ -1367,11 +1367,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; i < ec->items; i++) {
-			unsigned int j = i * sizeof(int) * ENUM_VAL_SIZE;
+		for (i = 0; i < ec->items; i++)
 			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));