From db0e1dcfc22fb2e408a12993cda2d604e0fb10f8 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 27 Feb 2017 09:46:18 +0100 Subject: [PATCH] topology: coverity - remove dead code --- src/topology/ctl.c | 5 ++--- src/topology/data.c | 2 +- src/topology/pcm.c | 17 +++++++---------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/topology/ctl.c b/src/topology/ctl.c index 1da3d18d..c026c2a9 100644 --- a/src/topology/ctl.c +++ b/src/topology/ctl.c @@ -173,7 +173,7 @@ static int tplg_build_enum_control(snd_tplg_t *tplg, { struct tplg_ref *ref; struct list_head *base, *pos; - int err = 0; + int err; base = &elem->ref_list; @@ -198,8 +198,7 @@ static int tplg_build_enum_control(snd_tplg_t *tplg, SNDERR("error: cannot find '%s' referenced by" " control '%s'\n", ref->id, elem->id); return -EINVAL; - } else if (err < 0) - return err; + } } return 0; diff --git a/src/topology/data.c b/src/topology/data.c index 8fe2342d..31e4ee12 100644 --- a/src/topology/data.c +++ b/src/topology/data.c @@ -917,7 +917,7 @@ int tplg_build_manifest_data(snd_tplg_t *tplg) 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) { diff --git a/src/topology/pcm.c b/src/topology/pcm.c index 5568d573..50a373a6 100644 --- a/src/topology/pcm.c +++ b/src/topology/pcm.c @@ -79,8 +79,8 @@ static int build_pcm(snd_tplg_t *tplg, struct tplg_elem *elem) int err; err = tplg_build_stream_caps(tplg, elem->id, elem->pcm->caps); - if (err < 0) - return err; + if (err < 0) + return err; /* merge private data from the referenced data elements */ base = &elem->ref_list; @@ -96,8 +96,7 @@ static int build_pcm(snd_tplg_t *tplg, struct tplg_elem *elem) SNDERR("error: cannot find '%s' referenced by" " PCM '%s'\n", ref->id, elem->id); return -EINVAL; - } else if (err < 0) - return err; + } } return 0; @@ -1208,12 +1207,10 @@ int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) /* ID and names */ link->id = link_tpl->id; - if (link->name) - elem_copy_text(link->name, link_tpl->name, - SNDRV_CTL_ELEM_ID_NAME_MAXLEN); - if (link->stream_name) - elem_copy_text(link->stream_name, link_tpl->stream_name, - SNDRV_CTL_ELEM_ID_NAME_MAXLEN); + elem_copy_text(link->name, link_tpl->name, + SNDRV_CTL_ELEM_ID_NAME_MAXLEN); + elem_copy_text(link->stream_name, link_tpl->stream_name, + SNDRV_CTL_ELEM_ID_NAME_MAXLEN); /* stream configs */ if (link_tpl->num_streams > SND_SOC_TPLG_STREAM_CONFIG_MAX) -- 2.47.1