list_for_each(pos, base) {
ref = list_entry(pos, struct tplg_ref, list);
- if (ref->id == NULL || ref->elem)
+ if (ref->elem)
continue;
if (ref->type == SND_TPLG_TYPE_TLV) {
list_for_each(pos, base) {
ref = list_entry(pos, struct tplg_ref, list);
- if (ref->id == NULL || ref->elem)
+ if (ref->elem)
continue;
if (ref->type == SND_TPLG_TYPE_TEXT) {
list_for_each(pos, base) {
ref = list_entry(pos, struct tplg_ref, list);
- if (ref->id == NULL || ref->elem)
+ if (ref->elem)
continue;
if (ref->type == SND_TPLG_TYPE_DATA) {
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");
}
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",
static void dump_priv_data(struct tplg_elem *elem)
{
struct snd_soc_tplg_private *priv = elem->data;
- unsigned char *p = (unsigned char *)priv->data;
unsigned int i, j = 0;
tplg_dbg(" elem size = %d, priv data size = %d\n",
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;
if (!ref->elem) {
list_for_each(pos, base) {
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;
}
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;
tplg_dbg("tuples '%s' used by data '%s'\n", ref->id, elem->id);
if (snd_config_get_id(n, &id))
continue;
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;
+ }
elem->index = atoi(val);
}
}