mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-17 18:56:24 +00:00
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>
This commit is contained in:
parent
54d96a40e0
commit
28d1ad09c5
@ -305,6 +305,8 @@ static int rt286_jack_detect(struct rt286_priv *rt286, bool *hp, bool *mic)
|
||||
*hp = false;
|
||||
*mic = false;
|
||||
|
||||
if (!rt286->codec)
|
||||
return -EINVAL;
|
||||
if (rt286->pdata.cbj_en) {
|
||||
regmap_read(rt286->regmap, RT286_GET_HP_SENSE, &buf);
|
||||
*hp = buf & 0x80000000;
|
||||
|
Loading…
x
Reference in New Issue
Block a user