mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
topology: fix coverity issues
This commit is contained in:
parent
996dd33b5f
commit
7f3ad37fd7
4 changed files with 15 additions and 9 deletions
|
|
@ -130,7 +130,7 @@ static int tplg_build_mixer_control(snd_tplg_t *tplg,
|
||||||
list_for_each(pos, base) {
|
list_for_each(pos, base) {
|
||||||
|
|
||||||
ref = list_entry(pos, struct tplg_ref, list);
|
ref = list_entry(pos, struct tplg_ref, list);
|
||||||
if (ref->id == NULL || ref->elem)
|
if (ref->elem)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ref->type == SND_TPLG_TYPE_TLV) {
|
if (ref->type == SND_TPLG_TYPE_TLV) {
|
||||||
|
|
@ -180,7 +180,7 @@ static int tplg_build_enum_control(snd_tplg_t *tplg,
|
||||||
list_for_each(pos, base) {
|
list_for_each(pos, base) {
|
||||||
|
|
||||||
ref = list_entry(pos, struct tplg_ref, list);
|
ref = list_entry(pos, struct tplg_ref, list);
|
||||||
if (ref->id == NULL || ref->elem)
|
if (ref->elem)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ref->type == SND_TPLG_TYPE_TEXT) {
|
if (ref->type == SND_TPLG_TYPE_TEXT) {
|
||||||
|
|
@ -216,7 +216,7 @@ static int tplg_build_bytes_control(snd_tplg_t *tplg, struct tplg_elem *elem)
|
||||||
list_for_each(pos, base) {
|
list_for_each(pos, base) {
|
||||||
|
|
||||||
ref = list_entry(pos, struct tplg_ref, list);
|
ref = list_entry(pos, struct tplg_ref, list);
|
||||||
if (ref->id == NULL || ref->elem)
|
if (ref->elem)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ref->type == SND_TPLG_TYPE_DATA) {
|
if (ref->type == SND_TPLG_TYPE_DATA) {
|
||||||
|
|
|
||||||
|
|
@ -428,7 +428,7 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg,
|
||||||
snd_config_t *n;
|
snd_config_t *n;
|
||||||
int err;
|
int err;
|
||||||
const char *graph_id, *val = NULL;
|
const char *graph_id, *val = NULL;
|
||||||
int index;
|
int index = -1;
|
||||||
|
|
||||||
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
SNDERR("error: compound is expected for dapm graph definition\n");
|
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 (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);
|
err = tplg_parse_routes(tplg, n, index);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
SNDERR("error: failed to parse dapm graph %s\n",
|
SNDERR("error: failed to parse dapm graph %s\n",
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,6 @@ err:
|
||||||
static void dump_priv_data(struct tplg_elem *elem)
|
static void dump_priv_data(struct tplg_elem *elem)
|
||||||
{
|
{
|
||||||
struct snd_soc_tplg_private *priv = elem->data;
|
struct snd_soc_tplg_private *priv = elem->data;
|
||||||
unsigned char *p = (unsigned char *)priv->data;
|
|
||||||
unsigned int i, j = 0;
|
unsigned int i, j = 0;
|
||||||
|
|
||||||
tplg_dbg(" elem size = %d, priv data size = %d\n",
|
tplg_dbg(" elem size = %d, priv data size = %d\n",
|
||||||
|
|
@ -366,7 +365,7 @@ static struct tplg_elem *get_tokens(snd_tplg_t *tplg, struct tplg_elem *elem)
|
||||||
|
|
||||||
ref = list_entry(pos, struct tplg_ref, list);
|
ref = list_entry(pos, struct tplg_ref, list);
|
||||||
|
|
||||||
if (!ref->id || ref->type != SND_TPLG_TYPE_TOKEN)
|
if (ref->type != SND_TPLG_TYPE_TOKEN)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!ref->elem) {
|
if (!ref->elem) {
|
||||||
|
|
@ -390,7 +389,7 @@ static bool has_tuples(struct tplg_elem *elem)
|
||||||
list_for_each(pos, base) {
|
list_for_each(pos, base) {
|
||||||
|
|
||||||
ref = list_entry(pos, struct tplg_ref, list);
|
ref = list_entry(pos, struct tplg_ref, list);
|
||||||
if (ref->id && ref->type == SND_TPLG_TYPE_TUPLE)
|
if (ref->type == SND_TPLG_TYPE_TUPLE)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -504,7 +503,7 @@ static int build_tuples(snd_tplg_t *tplg, struct tplg_elem *elem)
|
||||||
|
|
||||||
ref = list_entry(pos, struct tplg_ref, list);
|
ref = list_entry(pos, struct tplg_ref, list);
|
||||||
|
|
||||||
if (!ref->id || ref->type != SND_TPLG_TYPE_TUPLE)
|
if (ref->type != SND_TPLG_TYPE_TUPLE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
tplg_dbg("tuples '%s' used by data '%s'\n", ref->id, elem->id);
|
tplg_dbg("tuples '%s' used by data '%s'\n", ref->id, elem->id);
|
||||||
|
|
|
||||||
|
|
@ -178,8 +178,10 @@ struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg,
|
||||||
if (snd_config_get_id(n, &id))
|
if (snd_config_get_id(n, &id))
|
||||||
continue;
|
continue;
|
||||||
if (strcmp(id, "index") == 0) {
|
if (strcmp(id, "index") == 0) {
|
||||||
if (snd_config_get_string(n, &val) < 0)
|
if (snd_config_get_string(n, &val) < 0) {
|
||||||
|
free(elem);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
elem->index = atoi(val);
|
elem->index = atoi(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue