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] [<ffffff80088e9028>] dapm_widget_invalidate_output_paths+0x98/0xe0
[   79.193044] [<ffffff80088ea0d0>] soc_dapm_dai_stream_event+0x60/0x9c
[   79.193611] [<ffffff80088eeb9c>] snd_soc_dapm_stream_event+0x44/0x94
[   79.194175] [<ffffff80088e515c>] snd_soc_suspend+0x23c/0x2fc
[   79.194686] [<ffffff800852d1f0>] platform_pm_suspend+0x38/0x54
[   79.195208] [<ffffff8008536e88>] dpm_run_callback+0x110/0x1bc
[   79.195726] [<ffffff8008537578>] __device_suspend+0x164/0x2a4
[   79.196242] [<ffffff80085392b0>] dpm_suspend+0x70/0x338
[   79.196713] [<ffffff8008539ab0>] dpm_suspend_start+0x64/0x68
[   79.197226] [<ffffff80080f0b9c>] suspend_devices_and_enter+0x74/0x2d8
[   79.197800] [<ffffff80080f140c>] pm_suspend+0x60c/0x668
[   79.198272] [<ffffff80080ef7b4>] state_store+0x50/0x84
[   79.198734] [<ffffff800839d128>] kobj_attr_store+0x14/0x24
[   79.199234] [<ffffff8008232fd8>] sysfs_kf_write+0x38/0x50
[   79.199718] [<ffffff8008232208>] kernfs_fop_write+0x124/0x180
[   79.200237] [<ffffff80081bf76c>] __vfs_write+0x38/0xfc
[   79.200695] [<ffffff80081bffd4>] vfs_write+0x9c/0x170
[   79.201153] [<ffffff80081c0a18>] SyS_write+0x5c/0xbc
[   79.201604] [<ffffff80080832f0>] 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 <sugar.zhang@rock-chips.com>
This commit is contained in:
Sugar Zhang
2019-03-12 09:21:28 +08:00
committed by Tao Huang
parent 8440d5b8dd
commit f15ca45bf0

View File

@@ -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)