topology: tplg_elem_lookup() checks parameter before searching

Check the parameters at first in case of misuse.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Mengdong Lin 2016-11-04 07:08:27 +08:00 committed by Takashi Iwai
parent 4136d98606
commit d170e1ffa1

View file

@ -111,6 +111,9 @@ struct tplg_elem *tplg_elem_lookup(struct list_head *base, const char* id,
struct list_head *pos; struct list_head *pos;
struct tplg_elem *elem; struct tplg_elem *elem;
if (!base || !id)
return NULL;
list_for_each(pos, base) { list_for_each(pos, base) {
elem = list_entry(pos, struct tplg_elem, list); elem = list_entry(pos, struct tplg_elem, list);