ASoC: es8316: fix null pointer error

due to function will be called from rk_headset_irq_hook_adc.c
when es8316 configured in defconfig file but not in device tree

Change-Id: Ie0294fff2c05b9f77c6740d81dc9445007c1b62b
Signed-off-by: zhangjun <zhangjun@rock-chips.com>
This commit is contained in:
zhangjun
2016-12-19 20:49:46 +08:00
committed by Huang, Tao
parent e4dc8c0001
commit b50d6cbbe2

View File

@@ -1003,7 +1003,12 @@ static irqreturn_t es8316_irq_handler(int irq, void *data)
*/
int es8316_headset_detect(int jack_insert)
{
struct es8316_priv *es8316 = snd_soc_codec_get_drvdata(es8316_codec);
struct es8316_priv *es8316;
if (!es8316_codec)
return -1;
es8316 = snd_soc_codec_get_drvdata(es8316_codec);
es8316->hp_inserted = jack_insert;