diff options
author | Peter Ujfalusi <[email protected]> | 2022-04-21 15:18:47 -0500 |
---|---|---|
committer | Mark Brown <[email protected]> | 2022-04-23 00:16:21 +0100 |
commit | 14bdc7b2f9ea0d3f86beed93079ce40a7ead57ac (patch) | |
tree | 6f22404d1c3ee8924f80ca3ce097de4603cb12cf | |
parent | d516e96bdeca103224de2f84685bf733953b6303 (diff) |
ASoC: SOF: topology: Check w->sname validity once in sof_connect_dai_widget()
The 'w' (struct snd_soc_dapm_widget) is not changing within the function,
there is no reason to check the w->sname more than once as it is not
going to change.
Reviewed-by: Bard Liao <[email protected]>
Signed-off-by: Peter Ujfalusi <[email protected]>
Signed-off-by: Pierre-Louis Bossart <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
-rw-r--r-- | sound/soc/sof/topology.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 38e560ccaa57..5e959f8c4cb9 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -1012,15 +1012,18 @@ static int sof_connect_dai_widget(struct snd_soc_component *scomp, struct snd_soc_dai *cpu_dai; int i; + if (!w->sname) { + dev_err(scomp->dev, "Widget %s does not have stream\n", w->name); + return -EINVAL; + } + list_for_each_entry(rtd, &card->rtd_list, list) { dev_vdbg(scomp->dev, "tplg: check widget: %s stream: %s dai stream: %s\n", w->name, w->sname, rtd->dai_link->stream_name); - if (!w->sname || !rtd->dai_link->stream_name) - continue; - /* does stream match DAI link ? */ - if (strcmp(w->sname, rtd->dai_link->stream_name)) + if (!rtd->dai_link->stream_name || + strcmp(w->sname, rtd->dai_link->stream_name)) continue; switch (w->id) { |