topology: fix coverity issues

This commit is contained in:
Jaroslav Kysela 2017-10-22 15:02:19 +02:00
parent 996dd33b5f
commit 7f3ad37fd7
4 changed files with 15 additions and 9 deletions

View file

@ -428,7 +428,7 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg,
snd_config_t *n;
int err;
const char *graph_id, *val = NULL;
int index;
int index = -1;
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("error: compound is expected for dapm graph definition\n");
@ -452,6 +452,11 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg,
}
if (strcmp(id, "lines") == 0) {
if (index < 0) {
SNDERR("error: failed to parse dapm graph %s, missing index\n",
graph_id);
return -EINVAL;
}
err = tplg_parse_routes(tplg, n, index);
if (err < 0) {
SNDERR("error: failed to parse dapm graph %s\n",