topology: move the elem->list delete to tplg_elem_free()

The tplg_elem_free() is called in the error path from many places
and it is expected that the element object will be unregistered
from the tplg structure, too.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2020-01-03 22:07:11 +01:00
parent b6c9afb4f5
commit cb88813ff7

View file

@ -301,6 +301,8 @@ struct tplg_elem *tplg_elem_new(void)
void tplg_elem_free(struct tplg_elem *elem)
{
list_del(&elem->list);
tplg_ref_free_list(&elem->ref_list);
/* free struct snd_tplg_ object,
@ -323,7 +325,6 @@ void tplg_elem_free_list(struct list_head *base)
list_for_each_safe(pos, npos, base) {
elem = list_entry(pos, struct tplg_elem, list);
list_del(&elem->list);
tplg_elem_free(elem);
}
}