topology: avoid to use the atoi() directly when expected

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2019-12-14 13:36:09 +01:00
parent 9e2bbccfcc
commit f373bf1f6e
9 changed files with 150 additions and 133 deletions

View file

@ -80,8 +80,8 @@ int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg,
snd_config_iterator_t i, next;
snd_config_t *n;
struct snd_soc_tplg_channel *channel = private;
const char *id, *value;
int channel_id;
const char *id;
int channel_id, value;
if (tplg->channel_idx >= SND_SOC_TPLG_MAX_CHAN)
return -EINVAL;
@ -109,13 +109,13 @@ int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg,
continue;
/* get value */
if (snd_config_get_string(n, &value) < 0)
if (tplg_get_integer(n, &value, 0) < 0)
continue;
if (strcmp(id, "reg") == 0)
channel->reg = atoi(value);
channel->reg = value;
else if (strcmp(id, "shift") == 0)
channel->shift = atoi(value);
channel->shift = value;
tplg_dbg("\t\t%s = %s\n", id, value);
}