asoc: add null check for pcm pointer of snd_pcm_volume
In platform driver volume controls, add null check for
pcm pointer of struct snd_pcm_volume.
Change-Id: I511a79422eaeced6240849cbb665a289afdc5984
Signed-off-by: Xiaojun Sang <xsang@codeaurora.org>
diff --git a/asoc/msm-pcm-q6-noirq.c b/asoc/msm-pcm-q6-noirq.c
index e3f59e8..7338013 100644
--- a/asoc/msm-pcm-q6-noirq.c
+++ b/asoc/msm-pcm-q6-noirq.c
@@ -730,6 +730,12 @@
pr_err("%s: vol is NULL\n", __func__);
return -ENODEV;
}
+
+ if (!vol->pcm) {
+ pr_err("%s: vol->pcm is NULL\n", __func__);
+ return -ENODEV;
+ }
+
substream = vol->pcm->streams[vol->stream].substream;
if (!substream) {
pr_err("%s substream not found\n", __func__);