ASoC: rt5682: Fix panic in rt5682_jack_detect_handler happening during system shutdown
Subsystems (3)
PATCH 1/1 ASoC: rt5682: Fix panic in rt5682_jack_detect_handler happening during system shutdown
From: Sathyanarayana Nujella <[email protected]>
During Coldboot stress tests, system encountered the following panic. Panic logs depicts rt5682_i2c_shutdown() happened first and then later jack detect handler workqueue function triggered.
This situation causes panic as rt5682_i2c_shutdown() resets codec. Fix this panic by cancelling properly delayed work.
Panic log:
[ 20.936124] sof_pci_shutdown [ 20.940248] snd_sof_device_shutdown [ 20.945023] snd_sof_shutdown [ 21.126849] rt5682_i2c_shutdown [ 21.286053] rt5682_jack_detect_handler [ 21.291235] BUG: kernel NULL pointer dereference, address: 000000000000037c [ 21.299302] #PF: supervisor read access in kernel mode [ 21.305254] #PF: error_code(0x0000) - not-present page [ 21.311218] PGD 0 P4D 0 [ 21.314155] Oops: 0000 [#1] PREEMPT SMP NOPTI [ 21.319206] CPU: 2 PID: 123 Comm: kworker/2:3 Tainted: G U 5.4.68 #10 [ 21.333687] ACPI: Preparing to enter system sleep state S5 [ 21.337669] Workqueue: events_power_efficient rt5682_jack_detect_handler [snd_soc_rt5682] [ 21.337671] RIP: 0010:rt5682_jack_detect_handler+0x6c/0x279 [snd_soc_rt5682]
--- sound/soc/codecs/rt5682-i2c.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/codecs/rt5682-i2c.c +2 -0
@@ -273,6 +273,8 @@ static void rt5682_i2c_shutdown(struct i2c_client *client) {struct rt5682_priv *rt5682 =i2c_get_clientdata (client); +cancel_delayed_work_sync (&rt5682->jack_detect_work); +rt5682_reset (rt5682); }
Signature · 1 line
2.25.1
Quoted 40 lines · Ranjani Sridharan
From: Sathyanarayana Nujella <[email protected]>
During Coldboot stress tests, system encountered the following panic. Panic logs depicts
rt5682_i2c_shutdown()happened first and then later jack detect handler workqueue function triggered.
This situation causes panic asrt5682_i2c_shutdown()resets codec. Fix this panic by cancelling properly delayed work.Panic log:
[ 20.936124] sof_pci_shutdown [ 20.940248] snd_sof_device_shutdown [ 20.945023] snd_sof_shutdown [ 21.126849] rt5682_i2c_shutdown [ 21.286053] rt5682_jack_detect_handler [ 21.291235] BUG: kernel NULL pointer dereference, address: 000000000000037c [ 21.299302] #PF: supervisor read access in kernel mode [ 21.305254] #PF: error_code(0x0000) - not-present page [ 21.311218] PGD 0 P4D 0 [ 21.314155] Oops: 0000 [#1] PREEMPT SMP NOPTI [ 21.319206] CPU: 2 PID: 123 Comm: kworker/2:3 Tainted: G U 5.4.68 #10 [ 21.333687] ACPI: Preparing to enter system sleep state S5 [ 21.337669] Workqueue: events_power_efficient rt5682_jack_detect_handler [snd_soc_rt5682] [ 21.337671] RIP: 0010:rt5682_jack_detect_handler+0x6c/0x279 [snd_soc_rt5682]Fixes a50067d4f3c1d ('ASoC: rt5682: split i2c driver into separate module')Signed-off-by Jairaj Arava <[email protected]>Signed-off-by Sathyanarayana Nujella <[email protected]>Reviewed-by Pierre-Louis Bossart <[email protected]>Reviewed-by Shuming Fan <[email protected]>Signed-off-by Ranjani Sridharan <[email protected]>--- sound/soc/codecs/rt5682-i2c.c | 2 ++ 1 file changed, 2 insertions(+)sound/soc/codecs/rt5682-i2c.c +0
-0
sound/soc/codecs/rt5682-i2c.c static void rt5682_i2c_shutdown(struct i2c_client *client) · line 279
Quoted 7 lines
sound/soc/codecs/rt5682-i2c.c +2
-0@@ -273,6 +273,8 @@ static void rt5682_i2c_shutdown(struct i2c_client *client) {struct rt5682_priv *rt5682 =i2c_get_clientdata (client); +cancel_delayed_work_sync (&rt5682->jack_detect_work); +rt5682_reset (rt5682); }
The driver has two works. Doesn't another one need Canceling? Just to be sure...
thanks,
Takashi
Quoted 55 lines · Takashi Iwai
Quoted 53 lines · Ranjani Sridharan
From: Sathyanarayana Nujella <[email protected]>
During Coldboot stress tests, system encountered the following panic.
Panic logs depictsrt5682_i2c_shutdown()happened first and then later
jack detect handler workqueue function triggered.
This situation causes panic asrt5682_i2c_shutdown()resets codec. Fix this panic by cancelling properly delayed work.Panic log:
[ 20.936124] sof_pci_shutdown [ 20.940248] snd_sof_device_shutdown [ 20.945023] snd_sof_shutdown [ 21.126849] rt5682_i2c_shutdown [ 21.286053] rt5682_jack_detect_handler [ 21.291235] BUG: kernel NULL pointer dereference, address: 000000000000037c [ 21.299302] #PF: supervisor read access in kernel mode [ 21.305254] #PF: error_code(0x0000) - not-present page [ 21.311218] PGD 0 P4D 0 [ 21.314155] Oops: 0000 [#1] PREEMPT SMP NOPTI [ 21.319206] CPU: 2 PID: 123 Comm: kworker/2:3 Tainted: G U 5.4.68 #10 [ 21.333687] ACPI: Preparing to enter system sleep state S5 [ 21.337669] Workqueue: events_power_efficient rt5682_jack_detect_handler [snd_soc_rt5682] [ 21.337671] RIP: 0010:rt5682_jack_detect_handler+0x6c/0x279[
snd_soc_rt5682]Fixes a50067d4f3c1d ('ASoC: rt5682: split i2c driver into separatemodule')
Signed-off-by Jairaj Arava <[email protected]>Signed-off-by Sathyanarayana Nujella <Reviewed-by Pierre-Louis Bossart <[email protected]>Reviewed-by Shuming Fan <[email protected]>Signed-off-by Ranjani Sridharan <[email protected]Quoted 1 line
--- sound/soc/codecs/rt5682-i2c.c | 2 ++ 1 file changed, 2 insertions(+)sound/soc/codecs/rt5682-i2c.c +0
-0@@ -273,6 +273,8 @@ static void rt5682_i2c_shutdown(struct i2c_client *client) {struct rt5682_priv *rt5682 =i2c_get_clientdata (client);
Quoted 8 lines
sound/soc/codecs/rt5682-i2c.c static void rt5682_i2c_shutdown(struct i2c_client *client) · line 279
Quoted 4 lines
sound/soc/codecs/rt5682-i2c.c +2
-0+cancel_delayed_work_sync (&rt5682->jack_detect_work); +rt5682_reset (rt5682); }The driver has two works. Doesn't another one need Canceling?
Just to be sure...
Good point, it looks like maybe we need to cancel &rt5682-
Quoted 1 line
jd_check_workas well.
Thanks,Ranjani
Quoted 4 lines
thanks,
Takashi