From f15ca45bf0d24c82afdf35f6e5091ec4196ceccb Mon Sep 17 00:00:00 2001 From: Sugar Zhang Date: Tue, 12 Mar 2019 09:21:28 +0800 Subject: [PATCH] ASoC: core: Fix panic when two cards register using the same dai This issue was caused by two cards using the same dai(cpu_dai/codec_dai). the second one will fail to register as a card, then will release the same dai resource, leading to the first card crash. [ 79.032274] Unable to handle kernel paging request at virtual address ffffffffffffffe0 [ 79.035543] Hardware name: Rockchip RK3399 Excavator Board edp (Android) (DT) [ 79.036171] task: ffffffc0dd126c00 task.stack: ffffffc0d109c000 [ 79.036717] PC is at dapm_widget_invalidate_output_paths+0x98/0xe0 [ 79.037268] LR is at soc_dapm_dai_stream_event+0x60/0x9c [ 79.184613] Call trace: [ 79.192401] [] dapm_widget_invalidate_output_paths+0x98/0xe0 [ 79.193044] [] soc_dapm_dai_stream_event+0x60/0x9c [ 79.193611] [] snd_soc_dapm_stream_event+0x44/0x94 [ 79.194175] [] snd_soc_suspend+0x23c/0x2fc [ 79.194686] [] platform_pm_suspend+0x38/0x54 [ 79.195208] [] dpm_run_callback+0x110/0x1bc [ 79.195726] [] __device_suspend+0x164/0x2a4 [ 79.196242] [] dpm_suspend+0x70/0x338 [ 79.196713] [] dpm_suspend_start+0x64/0x68 [ 79.197226] [] suspend_devices_and_enter+0x74/0x2d8 [ 79.197800] [] pm_suspend+0x60c/0x668 [ 79.198272] [] state_store+0x50/0x84 [ 79.198734] [] kobj_attr_store+0x14/0x24 [ 79.199234] [] sysfs_kf_write+0x38/0x50 [ 79.199718] [] kernfs_fop_write+0x124/0x180 [ 79.200237] [] __vfs_write+0x38/0xfc [ 79.200695] [] vfs_write+0x9c/0x170 [ 79.201153] [] SyS_write+0x5c/0xbc [ 79.201604] [] el0_svc_naked+0x24/0x28 [ 79.202079] Code: 54000081 f9408000 d1040000 17ffffef (39406025) [ 79.202693] ---[ end trace dec5980253348a7f ]--- Change-Id: I6bbbeefaa68a7d5dfccc1bba57d61216b4be1035 Signed-off-by: Sugar Zhang --- sound/soc/soc-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 62aa320c2070..9d70c24a9cb4 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2137,7 +2137,8 @@ probe_aux_dev_err: soc_remove_aux_devices(card); probe_dai_err: - soc_remove_dai_links(card); + if (ret != -ENODEV) + soc_remove_dai_links(card); card_probe_error: if (card->remove)