diff options
| author | Soumya Managoli <smanag@codeaurora.org> | 2018-09-06 15:55:58 +0530 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-09-17 03:53:13 -0700 |
| commit | c29b12e26d1a60b310f2a594f1af187852fc4097 (patch) | |
| tree | e53abc1329a6b8a5ffd761473784223073825103 | |
| parent | e106251f0f24b810b71ce8a02a06e0ee19648ac4 (diff) | |
ASoC: msm: qdsp6v2: Handle invalid session for dtmf enable
If session id is invalid then dtmf voice info will also
be invalid.
Add check to return error if session id is invalid.
CRs-Fixed: 2306771
Change-Id: I362340f9f666c95949eaa94d0ced4cb3a1b9abab
Signed-off-by: Soumya Managoli <smanag@codeaurora.org>
| -rw-r--r-- | sound/soc/msm/qdsp6v2/msm-pcm-voice-v2.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-voice-v2.c b/sound/soc/msm/qdsp6v2/msm-pcm-voice-v2.c index 1b8150e5a30f..2615ee61db21 100644 --- a/sound/soc/msm/qdsp6v2/msm-pcm-voice-v2.c +++ b/sound/soc/msm/qdsp6v2/msm-pcm-voice-v2.c @@ -60,6 +60,28 @@ static struct snd_pcm_hardware msm_pcm_hardware = { .fifo_size = 0, }; +static int is_valid_session_id(uint32_t session_id) +{ + int idx = 0; + + switch (session_id) { + case VOICE_SESSION_VSID: + case VOICE2_SESSION_VSID: + case VOLTE_SESSION_VSID: + case QCHAT_SESSION_VSID: + case VOWLAN_SESSION_VSID: + case VOICEMMODE1_VSID: + case VOICEMMODE2_VSID: + case ALL_SESSION_VSID: + idx = 1; + break; + default: + pr_debug("%s: Invalid session_id : %x\n", __func__, session_id); + break; + } + return idx; +} + static int get_idx_for_session(uint32_t session_id) { int idx = 0; @@ -684,6 +706,11 @@ static int msm_dtmf_detect_rx_vsid_cb_put(struct snd_kcontrol *kcontrol, uint32_t session_id = ucontrol->value.integer.value[0]; uint32_t enable = ucontrol->value.integer.value[1]; + if (!is_valid_session_id(session_id)) { + pr_err(" %s Invalid session_id : %x\n", __func__, session_id); + return -EINVAL; + } + if (enable) enable = 1; |
