diff options
author | Keyon Jie <yang.jie@linux.intel.com> | 2019-11-01 12:09:14 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-11-08 12:09:49 +0000 |
commit | 8cd73ce7ba6381feb9df763240dee3a6d4aff1ca (patch) | |
tree | ac2cd328023480a1d394f458fa51b58d03d871a7 /sound/soc/sof | |
parent | bd0b609e0c3362cb167c51d4bd4330d79fc00987 (diff) | |
download | linux-8cd73ce7ba6381feb9df763240dee3a6d4aff1ca.tar.bz2 |
ASoC: SOF: topology: fix missing NULL pointer check
Add check to avoid possible NULL pointer dereference issue.
This issue was reported by static analysis tools, we didn't face this
issue but we can't rule it out either as a false positive.
Reported-by: Keqiao Zhang <keqiao.zhang@intel.com>
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191101170916.26517-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof')
-rw-r--r-- | sound/soc/sof/topology.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 143b8259a70a..6096731e89ce 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -150,6 +150,11 @@ static int sof_keyword_dapm_event(struct snd_soc_dapm_widget *w, /* get runtime PCM params using widget's stream name */ spcm = snd_sof_find_spcm_name(sdev, swidget->widget->sname); + if (!spcm) { + dev_err(sdev->dev, "error: cannot find PCM for %s\n", + swidget->widget->name); + return -EINVAL; + } /* process events */ switch (event) { |