mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-18 11:17:07 +00:00
ASoC: SOF: topology: simplify code to prevent static analysis warnings
[ Upstream commit 55cb3dc271d81f1982c949a2ac483a6daf613b92 ] make KCFLAGS='-fanalyzer' sound/soc/sof/intel/ reports a possible NULL pointer dereference. sound/soc/sof/topology.c:1136:21: error: dereference of NULL ‘w’ [CWE-476] [-Werror=analyzer-null-dereference] 1136 | strcmp(w->sname, rtd->dai_link->stream_name)) The code is rather confusing and can be simplified to make static analysis happy. No functionality change. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Yaochun Hung <yc.hung@mediatek.com> Link: https://lore.kernel.org/r/20230731213748.440285-4-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
2ec715bf88
commit
d843bcc7ad
@ -1086,16 +1086,17 @@ static void sof_disconnect_dai_widget(struct snd_soc_component *scomp,
|
||||
{
|
||||
struct snd_soc_card *card = scomp->card;
|
||||
struct snd_soc_pcm_runtime *rtd;
|
||||
const char *sname = w->sname;
|
||||
struct snd_soc_dai *cpu_dai;
|
||||
int i;
|
||||
|
||||
if (!w->sname)
|
||||
if (!sname)
|
||||
return;
|
||||
|
||||
list_for_each_entry(rtd, &card->rtd_list, list) {
|
||||
/* does stream match DAI link ? */
|
||||
if (!rtd->dai_link->stream_name ||
|
||||
strcmp(w->sname, rtd->dai_link->stream_name))
|
||||
strcmp(sname, rtd->dai_link->stream_name))
|
||||
continue;
|
||||
|
||||
switch (w->id) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user