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>
*/
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;