diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2015-07-17 05:36:57 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-07-17 14:12:20 +0300 |
commit | f2a5ded38592e5936a099ea6535ad5d3addcbc9d (patch) | |
tree | 510494e37d61e1c0dace24259edb656c0cbb8b2b /sound | |
parent | d770e558e21961ad6cfdf0ff7df0eb5d7d4f0754 (diff) | |
download | linux-f2a5ded38592e5936a099ea6535ad5d3addcbc9d.tar.xz |
ASoC: rt5645: Check if codec is initialized in workqueue handler
This fixes kernel panic on boot, if rt5645->codec is NULL when
rt5645_jack_detect_work is first called.
rt5645_jack_detect_work needs rt5645->codec to be initialized to setup
dapm pins. Also, reporting jack events is useless, as the jacks cannot
be set before the codec is ready.
Since we manually call the interrupt handler in
rt5645_set_jack_detect, the initial jack state will be reported
correctly, and dapm pins will be setup at that time.
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/rt5645.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 9ce311e088fc..e9cc3aae5366 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -2943,6 +2943,9 @@ 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) { |