asoc: codecs: add null check before access

Add null check before accessing wcd938x private data.

Change-Id: Ia2226202deccccbd07e6c0d501daaded2b7e72d8
Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
This commit is contained in:
Vignesh Kulothungan
2019-04-05 11:04:10 -07:00
committed by Gerrit - the friendly Code Review server
parent 088ff5589b
commit 864f843779

View File

@@ -1355,6 +1355,13 @@ int wcd938x_micbias_control(struct snd_soc_component *component,
__func__, micb_index); __func__, micb_index);
return -EINVAL; return -EINVAL;
} }
if (NULL == wcd938x) {
dev_err(component->dev,
"%s: wcd938x private data is NULL\n", __func__);
return -EINVAL;
}
switch (micb_num) { switch (micb_num) {
case MIC_BIAS_1: case MIC_BIAS_1:
micb_reg = WCD938X_ANA_MICB1; micb_reg = WCD938X_ANA_MICB1;