asoc: codecs: add null pointer check for swr control data

Null check is needed before accessing swr control data
to ensure proper error handling in case speaker path
is issued when swr is not enabled.

Change-Id: I5037a912652189b3ae58f1119d0534777a9c264a
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
This commit is contained in:
Karthikeyan Mani
2018-02-06 15:22:37 -08:00
committed by Gerrit - the friendly Code Review server
부모 dd3e130abe
커밋 24afb6e390

파일 보기

@@ -2957,6 +2957,11 @@ static int __tavil_codec_enable_swr(struct snd_soc_dapm_widget *w, int event)
tavil = snd_soc_codec_get_drvdata(codec);
if (!tavil->swr.ctrl_data)
return -EINVAL;
if (!tavil->swr.ctrl_data[0].swr_pdev)
return -EINVAL;
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
if (((strnstr(w->name, "INT7_", sizeof("RX INT7_"))) ||