]> git.alsa-project.org Git - alsa-lib.git/commitdiff
topology: decode: Remove decoding values for enum control
authorPiotr Maziarz <piotrx.maziarz@linux.intel.com>
Mon, 31 Aug 2020 09:08:56 +0000 (11:08 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 31 Aug 2020 11:03:01 +0000 (13:03 +0200)
Values have no representation in standard ALSA configuration files,
therefore there is no need to populate them. Also memory for values
wasn't allocated which was causing undefined behaviour.

Signed-off-by: Piotr Maziarz <piotrx.maziarz@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/topology/ctl.c

index 0aa49ab82c1eb079bef138dac36979b6ef944bb7..02e482e7d05df4e387847e989ba44f4b34626618 100644 (file)
@@ -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));