summaryrefslogtreecommitdiff
path: root/asoc
diff options
context:
space:
mode:
authorxsang <xsang@codeaurora.org>2020-06-19 19:46:57 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2020-09-06 21:59:57 -0700
commite41f985fa4ce16bc1767595914f76d8d8eae88d0 (patch)
tree7de8f284560366170582a4a330f18a13af290b1f /asoc
parent908583ff00ed2b342fffc388e0a15693c2801bb4 (diff)
downloadmsm-extra-e41f985fa4ce16bc1767595914f76d8d8eae88d0.tar.gz
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>
Diffstat (limited to 'asoc')
-rw-r--r--asoc/msm-pcm-q6-noirq.c6
-rw-r--r--asoc/msm-pcm-q6-v2.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/asoc/msm-pcm-q6-noirq.c b/asoc/msm-pcm-q6-noirq.c
index e3f59e8d..7338013c 100644
--- a/asoc/msm-pcm-q6-noirq.c
+++ b/asoc/msm-pcm-q6-noirq.c
@@ -730,6 +730,12 @@ static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol,
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__);
diff --git a/asoc/msm-pcm-q6-v2.c b/asoc/msm-pcm-q6-v2.c
index 1592c3f7..de28f65a 100644
--- a/asoc/msm-pcm-q6-v2.c
+++ b/asoc/msm-pcm-q6-v2.c
@@ -1534,6 +1534,12 @@ static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol,
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__);