Merge branch 'fix/rt5645' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie...
authorMark Brown <broonie@kernel.org>
Mon, 20 Jul 2015 17:14:12 +0000 (18:14 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 20 Jul 2015 17:14:12 +0000 (18:14 +0100)
1  2 
sound/soc/codecs/rt5645.c

@@@ -2925,8 -2913,39 +2925,11 @@@ static void rt5645_jack_detect_work(str
  {
        struct rt5645_priv *rt5645 =
                container_of(work, struct rt5645_priv, jack_detect_work.work);
 -
 -      rt5645_irq_detection(rt5645);
 -}
 -
 -static irqreturn_t rt5645_irq(int irq, void *data)
 -{
 -      struct rt5645_priv *rt5645 = data;
 -
 -      queue_delayed_work(system_power_efficient_wq,
 -                         &rt5645->jack_detect_work, msecs_to_jiffies(250));
 -
 -      return IRQ_HANDLED;
 -}
 -
 -static int rt5645_button_detect(struct snd_soc_codec *codec)
 -{
 -      int btn_type, val;
 -
 -      val = snd_soc_read(codec, RT5650_4BTN_IL_CMD1);
 -      pr_debug("val=0x%x\n", val);
 -      btn_type = val & 0xfff0;
 -      snd_soc_write(codec, RT5650_4BTN_IL_CMD1, val);
 -
 -      return btn_type;
 -}
 -
 -static int rt5645_irq_detection(struct rt5645_priv *rt5645)
 -{
        int val, btn_type, gpio_state = 0, report = 0;
  
+       if (!rt5645->codec)
+               return -EINVAL;
        switch (rt5645->pdata.jd_mode) {
        case 0: /* Not using rt5645 JD */
                if (rt5645->gpiod_hp_det) {