asoc: common: fix null pointer access.

pdata return from msm_common_get_pdata may be NULL
and dereferenced.

Change-Id: Ied986d377f0fe8486c4be2c420d8d1b5f3868fd8
Signed-off-by: Prasad Kumpatla <pkumpatl@codeaurora.org>
This commit is contained in:
Prasad Kumpatla
2021-07-30 11:51:44 +05:30
committed by Gerrit - the friendly Code Review server
parent 02c5a3aca7
commit 8201861fd3

View File

@@ -289,6 +289,15 @@ int msm_common_snd_hw_params(struct snd_pcm_substream *substream,
int index = get_intf_index(stream_name);
struct clk_cfg tdm_clk_cfg;
dev_dbg(rtd->card->dev,
"%s: substream = %s stream = %d\n",
__func__, substream->name, substream->stream);
if (!pdata) {
dev_err(rtd->card->dev, "%s: pdata is NULL\n", __func__);
return -EINVAL;
}
if (index >= 0) {
mutex_lock(&pdata->lock[index]);
if (pdata->mi2s_gpio_p[index]) {