ASoC: wcd934x: Check for null pointer before access

Check dsd config structure pointer for null before
access to prevent kernel panic.

CRs-fixed: 1070189
Change-Id: I791941fbede4b136c3f24d15b7fb0b60dd5477e6
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
This commit is contained in:
Phani Kumar Uppalapati 2016-09-26 13:33:02 -07:00 committed by Gerrit - the friendly Code Review server
parent 626caf4e54
commit 33dbb2a735

View file

@ -378,6 +378,11 @@ static int tavil_enable_dsd(struct snd_soc_dapm_widget *w,
int interp_idx;
u8 pcm_rate_val;
if (!dsd_conf) {
dev_err(codec->dev, "%s: null dsd_config pointer\n", __func__);
return -EINVAL;
}
if (w->shift == DSD0) {
/* Read out select */
if (snd_soc_read(codec, WCD934X_CDC_DSD0_CFG0) & 0x02)