msm_common.c: fix dereference of pointer 'kctl_pdata' before NULL check

Change-Id: I8d7843b13cdfe3b0e1783acc662e4d06ae7a739a
Signed-off-by: Harold Tan <harotan@codeaurora.org>
此提交包含在:
Harold Tan
2021-02-23 13:03:42 -08:00
提交者 Gerrit - the friendly Code Review server
父節點 37b25ca9ac
當前提交 fdab4dc6bf

查看文件

@@ -373,8 +373,8 @@ int msm_channel_map_get(struct snd_kcontrol *kcontrol,
{
struct chmap_pdata *kctl_pdata =
(struct chmap_pdata *)kcontrol->private_data;
struct snd_soc_dai *codec_dai = kctl_pdata->dai;
int backend_id = kctl_pdata->id;
struct snd_soc_dai *codec_dai = NULL;
int backend_id = 0;
uint32_t rx_ch[MAX_PORT], tx_ch[MAX_PORT];
uint32_t rx_ch_cnt = 0, tx_ch_cnt = 0;
uint32_t *chmap_data = NULL;
@@ -385,6 +385,9 @@ int msm_channel_map_get(struct snd_kcontrol *kcontrol,
return -EINVAL;
}
codec_dai = kctl_pdata->dai;
backend_id = kctl_pdata->id;
ret = snd_soc_dai_get_channel_map(codec_dai,
&tx_ch_cnt, tx_ch, &rx_ch_cnt, rx_ch);
if (ret || (tx_ch_cnt == 0 && rx_ch_cnt == 0)) {