aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeyon Jie <[email protected]>2019-11-01 12:09:14 -0500
committerMark Brown <[email protected]>2019-11-08 12:09:49 +0000
commit8cd73ce7ba6381feb9df763240dee3a6d4aff1ca (patch)
treeac2cd328023480a1d394f458fa51b58d03d871a7
parentbd0b609e0c3362cb167c51d4bd4330d79fc00987 (diff)
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 <[email protected]> Signed-off-by: Keyon Jie <[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.c5
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) {