diff options
author | Bard Liao <bardliao@realtek.com> | 2015-02-05 03:40:33 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-02-05 13:17:12 -0500 |
commit | 28d1ad09c50c758d3e295fa7ff90a4712e1254ea (patch) | |
tree | 5d107d6d0f9d6a8e94f6193660ef35b9f7b8fc94 /sound/soc | |
parent | 54d96a40e0dfb5aa2eea0b010ddc1c7e8742e364 (diff) |
ASoC: rt286: Fix potencial crash in jd function
We assign rt286->codec in rt286_probe. If rt286_jack_detect is
invoked before rt286_probe, rt286->codec will be NULL and cause
a kernel panic.
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/rt286.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c index 847cc4b9bee5..f14d335b07b1 100644 --- a/sound/soc/codecs/rt286.c +++ b/sound/soc/codecs/rt286.c | |||
@@ -305,6 +305,8 @@ static int rt286_jack_detect(struct rt286_priv *rt286, bool *hp, bool *mic) | |||
305 | *hp = false; | 305 | *hp = false; |
306 | *mic = false; | 306 | *mic = false; |
307 | 307 | ||
308 | if (!rt286->codec) | ||
309 | return -EINVAL; | ||
308 | if (rt286->pdata.cbj_en) { | 310 | if (rt286->pdata.cbj_en) { |
309 | regmap_read(rt286->regmap, RT286_GET_HP_SENSE, &buf); | 311 | regmap_read(rt286->regmap, RT286_GET_HP_SENSE, &buf); |
310 | *hp = buf & 0x80000000; | 312 | *hp = buf & 0x80000000; |