diff mbox series

[v2] ASoC: soc-core: defer card probe until all component is added to list

Message ID 1547023627-30312-1-git-send-email-rohitkr@codeaurora.org (mailing list archive)
State Accepted
Commit 8780cf1142a59568a3aa77959cbd76b2edb6fd81
Headers show
Series [v2] ASoC: soc-core: defer card probe until all component is added to list | expand

Commit Message

Rohit Kumar Jan. 9, 2019, 8:47 a.m. UTC
From: Ajit Pandey <ajitp@codeaurora.org>

DAI component probe is not called if it is not present
in component list during sound card registration.
Check if component is available in component list for
platform and cpu dai before soundcard registration.

Signed-off-by: Ajit Pandey <ajitp@codeaurora.org>
Signed-off-by: Rohit kumar <rohitkr@codeaurora.org>
---
Changes since v1:
Moved component find logic to soc-core instead of machine driver
as suggested by Mark.

 sound/soc/soc-core.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Comments

Kuninori Morimoto Jan. 10, 2019, 2:32 a.m. UTC | #1
Hi Mark, Ajit

> From: Ajit Pandey <ajitp@codeaurora.org>
> Date: Wed, 9 Jan 2019 14:17:07 +0530
> Subject: [PATCH] ASoC: soc-core: defer card probe until all component is added
>  to list
> 
> DAI component probe is not called if it is not present
> in component list during sound card registration.
> Check if component is available in component list for
> platform and cpu dai before soundcard registration.
> 
> Signed-off-by: Ajit Pandey <ajitp@codeaurora.org>
> Signed-off-by: Rohit kumar <rohitkr@codeaurora.org>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---

I got below WARNING by this patch.
I guess we need mutex_lock() on snd_soc_register_card() ?

	...
	[drm] Device feb00000.display probed
	[drm] Cannot find any crtc or sizes
	[drm] Cannot find any crtc or sizes
	WARNING: CPU: 0 PID: 76 at sound/soc/soc-core.c:739 soc_find_component+0xb8/0xc0
	CPU: 0 PID: 76 Comm: kworker/0:1 Not tainted 5.0.0-rc1+ #1360
	Hardware name: Renesas H3ULCB Kingfisher board based on r8a7795 ES2.0+ (DT)
	Workqueue: events deferred_probe_work_func
	pstate: 60000005 (nZCv daif -PAN -UAO)
	pc : soc_find_component+0xb8/0xc0
	lr : soc_find_component+0xb4/0xc0
	sp : ffff00001217ba10
	x29: ffff00001217ba10 x28: 0000000000000000 
	x27: ffff000010a82920 x26: 0000000000000000 
	x25: ffff8006f9c59900 x24: ffff0000105f33a0 
	x23: ffff000010948d70 x22: 0000000000000000 
	x21: ffff000010af1720 x20: ffff8006ff80b6d8 
	x19: ffff8006f8523080 x18: 0000000000000010 
	x17: 0000000000000000 x16: 0000000000000000 
	x15: ffffffffffffffff x14: 0720072007200720 
	x13: 0720072007200720 x12: 0720072007200720 
	x11: 0720072007200720 x10: 0720072007200720 
	x9 : 0000000000000000 x8 : ffff000010a85000 
	x7 : ffff000010114bd4 x6 : 0000000000000001 
	x5 : 0000000000000018 x4 : 0000000000000001 
	x3 : 0000000000000000 x2 : 0000000000000003 
	x1 : ffff000010af17b0 x0 : 0000000000000000 
	Call trace:
	 soc_find_component+0xb8/0xc0
	 soc_init_dai_link+0x18c/0x210
	 snd_soc_register_card.part.16+0x138/0x198
	 snd_soc_register_card+0x30/0x48
	 devm_snd_soc_register_card+0x4c/0xa0
	 graph_probe+0x2d8/0x388
	 platform_drv_probe+0x58/0xa8
	 really_probe+0x1c0/0x2a0
	 driver_probe_device+0x5c/0xf0
	 __device_attach_driver+0x9c/0xe0
	...
Rohit Kumar Jan. 10, 2019, 7:09 a.m. UTC | #2
Thanks Kuninori for reporting the issue.

On 1/10/2019 8:02 AM, Kuninori Morimoto wrote:
> Hi Mark, Ajit
>
>> From: Ajit Pandey <ajitp@codeaurora.org>
>> Date: Wed, 9 Jan 2019 14:17:07 +0530
>> Subject: [PATCH] ASoC: soc-core: defer card probe until all component is added
>>   to list
>>
>> DAI component probe is not called if it is not present
>> in component list during sound card registration.
>> Check if component is available in component list for
>> platform and cpu dai before soundcard registration.
>>
>> Signed-off-by: Ajit Pandey <ajitp@codeaurora.org>
>> Signed-off-by: Rohit kumar <rohitkr@codeaurora.org>
>> Signed-off-by: Mark Brown <broonie@kernel.org>
>> ---
> I got below WARNING by this patch.
> I guess we need mutex_lock() on snd_soc_register_card() ?

Right, we should have client_mutex lock before calling 
soc_find_component().

We will post fix.

>
> 	...
> 	[drm] Device feb00000.display probed
> 	[drm] Cannot find any crtc or sizes
> 	[drm] Cannot find any crtc or sizes
> 	WARNING: CPU: 0 PID: 76 at sound/soc/soc-core.c:739 soc_find_component+0xb8/0xc0
> 	CPU: 0 PID: 76 Comm: kworker/0:1 Not tainted 5.0.0-rc1+ #1360
> 	Hardware name: Renesas H3ULCB Kingfisher board based on r8a7795 ES2.0+ (DT)
> 	Workqueue: events deferred_probe_work_func
> 	pstate: 60000005 (nZCv daif -PAN -UAO)
> 	pc : soc_find_component+0xb8/0xc0
> 	lr : soc_find_component+0xb4/0xc0
> 	sp : ffff00001217ba10
> 	x29: ffff00001217ba10 x28: 0000000000000000
> 	x27: ffff000010a82920 x26: 0000000000000000
> 	x25: ffff8006f9c59900 x24: ffff0000105f33a0
> 	x23: ffff000010948d70 x22: 0000000000000000
> 	x21: ffff000010af1720 x20: ffff8006ff80b6d8
> 	x19: ffff8006f8523080 x18: 0000000000000010
> 	x17: 0000000000000000 x16: 0000000000000000
> 	x15: ffffffffffffffff x14: 0720072007200720
> 	x13: 0720072007200720 x12: 0720072007200720
> 	x11: 0720072007200720 x10: 0720072007200720
> 	x9 : 0000000000000000 x8 : ffff000010a85000
> 	x7 : ffff000010114bd4 x6 : 0000000000000001
> 	x5 : 0000000000000018 x4 : 0000000000000001
> 	x3 : 0000000000000000 x2 : 0000000000000003
> 	x1 : ffff000010af17b0 x0 : 0000000000000000
> 	Call trace:
> 	 soc_find_component+0xb8/0xc0
> 	 soc_init_dai_link+0x18c/0x210
> 	 snd_soc_register_card.part.16+0x138/0x198
> 	 snd_soc_register_card+0x30/0x48
> 	 devm_snd_soc_register_card+0x4c/0xa0
> 	 graph_probe+0x2d8/0x388
> 	 platform_drv_probe+0x58/0xa8
> 	 really_probe+0x1c0/0x2a0
> 	 driver_probe_device+0x5c/0xf0
> 	 __device_attach_driver+0x9c/0xe0
> 	...

Regards,
Rohit
Kuninori Morimoto Jan. 10, 2019, 7:29 a.m. UTC | #3
Hi Rohit

> > I got below WARNING by this patch.
> > I guess we need mutex_lock() on snd_soc_register_card() ?
> 
> Right, we should have client_mutex lock before calling
> soc_find_component().
> 
> We will post fix.

Thanks !!

Best regards
---
Kuninori Morimoto
Pierre-Louis Bossart Jan. 11, 2019, 5:07 a.m. UTC | #4
While debugging Skylake audio stuff, I came across a kernel oops 
introduced by this commit.

It's quite late here and my brain is fried, submitting as is but my 
money is on the use of link->platform->of_node which is quite unlikely 
to work on ACPI platforms.

and btw you may want to fix the typos, it's registration, not registartion.

-Pierre

8780cf1142a59568a3aa77959cbd76b2edb6fd81 is the first bad commit
commit 8780cf1142a59568a3aa77959cbd76b2edb6fd81
Author: Ajit Pandey <ajitp@codeaurora.org>
Date:   Wed Jan 9 14:17:07 2019 +0530

     ASoC: soc-core: defer card probe until all component is added to list

     DAI component probe is not called if it is not present
     in component list during sound card registration.
     Check if component is available in component list for
     platform and cpu dai before soundcard registration.

     Signed-off-by: Ajit Pandey <ajitp@codeaurora.org>
     Signed-off-by: Rohit kumar <rohitkr@codeaurora.org>
     Signed-off-by: Mark Brown <broonie@kernel.org>

:040000 040000 98da59b0a73551030a0c9030b8cd58114003c82b 
48f0618f37a16dcfea5999ecd9743edbb0763594 M    sound

[    2.686029] HDMI HDA Codec ehdaudio0D2: Max dais supported: 3
[    2.687854] BUG: unable to handle kernel NULL pointer dereference at 
0000000000000000
[    2.687858] PGD 0 P4D 0
[    2.687862] Oops: 0000 [#1] SMP PTI
[    2.687866] CPU: 1 PID: 1647 Comm: systemd-udevd Not tainted 
4.20.0-rc7-test+ #88
[    2.687867] Hardware name: Dell Inc. XPS 13 9350/07TYC2, BIOS 1.0.0 
09/10/2015
[    2.687872] RIP: 0010:strcmp+0xc/0x20
[    2.687875] Code: 75 f7 48 83 c6 01 0f b6 4e ff 48 83 c2 01 84 c9 88 
4a ff 75 ed f3 c3 0f 1f 80 00 00 00 00 48 83 c7 01 0f b6 47 ff 48 83 c6 
01 <3a> 46 ff 75 07 84 c0 75 eb 31 c0 c3 19 c0 83 c8 01 c3 66 90 48 85
[    2.687877] RSP: 0018:ffff9fadc104bb18 EFLAGS: 00010202
[    2.687880] RAX: 0000000000000065 RBX: ffff9d6834ba5428 RCX: 
0000000000000001
[    2.687882] RDX: ffffffffc0288d00 RSI: 0000000000000001 RDI: 
ffff9d68351b5a61
[    2.687883] RBP: 0000000000000000 R08: 0000000000000001 R09: 
ffff9d6836dbfd80
[    2.687885] R10: 0000000000000000 R11: ffff9d6835e65648 R12: 
0000000000000000
[    2.687887] R13: 0000000000000000 R14: 0000000000000000 R15: 
ffff9fadc104be98
[    2.687889] FS:  00007f976806a8c0(0000) GS:ffff9d6838a80000(0000) 
knlGS:0000000000000000
[    2.687891] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    2.687893] CR2: 0000000000000000 CR3: 00000002b4286002 CR4: 
00000000003606e0
[    2.687895] Call Trace:
[    2.687902]  soc_find_component+0x4c/0x70 [snd_soc_core]
[    2.687908]  soc_init_dai_link+0x124/0x280 [snd_soc_core]
[    2.687913]  snd_soc_register_card+0x6b/0x1f0 [snd_soc_core]
[    2.687918]  ? __devres_alloc_node+0x2c/0x60
[    2.687922]  devm_snd_soc_register_card+0x3e/0x80 [snd_soc_core]
[    2.687926]  platform_drv_probe+0x35/0x90
[    2.687930]  ? driver_sysfs_add+0x70/0xd0
[    2.687932]  really_probe+0xee/0x2e0
[    2.687935]  driver_probe_device+0x4a/0xe0
[    2.687938]  __driver_attach+0xac/0xb0
[    2.687941]  ? driver_probe_device+0xe0/0xe0
[    2.687943]  bus_for_each_dev+0x71/0xb0
[    2.687946]  bus_add_driver+0x191/0x210
[    2.687948]  ? 0xffffffffc01bf000
[    2.687951]  driver_register+0x56/0xe0
[    2.687953]  ? 0xffffffffc01bf000
[    2.687956]  do_one_initcall+0x41/0x1b8
[    2.687960]  ? kobject_uevent_env+0x101/0x680
[    2.687962]  ? _cond_resched+0x10/0x40
[    2.687966]  ? kmem_cache_alloc_trace+0x35/0x160
[    2.687969]  do_init_module+0x56/0x1db
[    2.687973]  load_module+0x1e7c/0x2560
[    2.687976]  ? vfs_read+0x10a/0x130
[    2.687979]  ? __do_sys_finit_module+0xba/0xe0
[    2.687983]  __do_sys_finit_module+0xba/0xe0
[    2.687988]  do_syscall_64+0x43/0xf0
[    2.687992]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[    2.687995] RIP: 0033:0x7f9768aef219
[    2.687998] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 
48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 
05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 47 fc 0c 00 f7 d8 64 89 01 48
[    2.688000] RSP: 002b:00007ffccf3a4c98 EFLAGS: 00000246 ORIG_RAX: 
0000000000000139
[    2.688003] RAX: ffffffffffffffda RBX: 000055991cf57970 RCX: 
00007f9768aef219
[    2.688006] RDX: 0000000000000000 RSI: 00007f97689d3cad RDI: 
000000000000000f
[    2.688008] RBP: 00007f97689d3cad R08: 0000000000000000 R09: 
0000000000000000
[    2.688010] R10: 000000000000000f R11: 0000000000000246 R12: 
0000000000000000
[    2.688012] R13: 000055991cf49930 R14: 0000000000020000 R15: 
000055991cf57970
[    2.688015] Modules linked in: snd_soc_skl_hda_dsp(+) 
snd_soc_hdac_hdmi snd_soc_dmic ax88179_178a(+) usbnet 
snd_hda_codec_realtek snd_hda_codec_generic snd_soc_skl snd_soc_hdac_hda 
snd_hda_ext_core snd_soc_skl_ipc x86_pkg_temp_thermal snd_soc_sst_ipc 
snd_soc_sst_dsp snd_soc_acpi_intel_match snd_soc_acpi snd_soc_core 
snd_compress snd_hda_codec snd_hwdep snd_hda_core snd_pcm efivarfs 
intel_lpss_pci xhci_pci intel_lpss mfd_core xhci_hcd
[    2.688031] CR2: 0000000000000000
[    2.688034] ---[ end trace 8b96d01935d9effd ]---
[    2.688037] RIP: 0010:strcmp+0xc/0x20
[    2.688039] Code: 75 f7 48 83 c6 01 0f b6 4e ff 48 83 c2 01 84 c9 88 
4a ff 75 ed f3 c3 0f 1f 80 00 00 00 00 48 83 c7 01 0f b6 47 ff 48 83 c6 
01 <3a> 46 ff 75 07 84 c0 75 eb 31 c0 c3 19 c0 83 c8 01 c3 66 90 48 85
[    2.688042] RSP: 0018:ffff9fadc104bb18 EFLAGS: 00010202
[    2.688044] RAX: 0000000000000065 RBX: ffff9d6834ba5428 RCX: 
0000000000000001
[    2.688046] RDX: ffffffffc0288d00 RSI: 0000000000000001 RDI: 
ffff9d68351b5a61
[    2.688048] RBP: 0000000000000000 R08: 0000000000000001 R09: 
ffff9d6836dbfd80
[    2.688050] R10: 0000000000000000 R11: ffff9d6835e65648 R12: 
0000000000000000
[    2.688052] R13: 0000000000000000 R14: 0000000000000000 R15: 
ffff9fadc104be98
[    2.688055] FS:  00007f976806a8c0(0000) GS:ffff9d6838a80000(0000) 
knlGS:0000000000000000
[    2.688057] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    2.688059] CR2: 0000000000000000 CR3: 00000002b4286002 CR4: 
00000000003606e0
Rohit Kumar Jan. 11, 2019, 8:11 a.m. UTC | #5
Thanks Pierre for reporting the issue.

On 1/11/2019 10:37 AM, Pierre-Louis Bossart wrote:
> While debugging Skylake audio stuff, I came across a kernel oops 
> introduced by this commit.
>
> It's quite late here and my brain is fried, submitting as is but my 
> money is on the use of link->platform->of_node which is quite unlikely 
> to work on ACPI platforms.
>

Right, either name or of_node should not be NULL for soc_find_component.

We will provide fix.

> and btw you may want to fix the typos, it's registration, not 
> registartion.


Sure.

>
> -Pierre
>
> 8780cf1142a59568a3aa77959cbd76b2edb6fd81 is the first bad commit
> commit 8780cf1142a59568a3aa77959cbd76b2edb6fd81
> Author: Ajit Pandey <ajitp@codeaurora.org>
> Date:   Wed Jan 9 14:17:07 2019 +0530
>
>     ASoC: soc-core: defer card probe until all component is added to list
>
>     DAI component probe is not called if it is not present
>     in component list during sound card registration.
>     Check if component is available in component list for
>     platform and cpu dai before soundcard registration.
>
>     Signed-off-by: Ajit Pandey <ajitp@codeaurora.org>
>     Signed-off-by: Rohit kumar <rohitkr@codeaurora.org>
>     Signed-off-by: Mark Brown <broonie@kernel.org>
>
> :040000 040000 98da59b0a73551030a0c9030b8cd58114003c82b 
> 48f0618f37a16dcfea5999ecd9743edbb0763594 M    sound
>
> [    2.686029] HDMI HDA Codec ehdaudio0D2: Max dais supported: 3
> [    2.687854] BUG: unable to handle kernel NULL pointer dereference 
> at 0000000000000000
> [    2.687858] PGD 0 P4D 0
> [    2.687862] Oops: 0000 [#1] SMP PTI
> [    2.687866] CPU: 1 PID: 1647 Comm: systemd-udevd Not tainted 
> 4.20.0-rc7-test+ #88
> [    2.687867] Hardware name: Dell Inc. XPS 13 9350/07TYC2, BIOS 1.0.0 
> 09/10/2015
> [    2.687872] RIP: 0010:strcmp+0xc/0x20
> [    2.687875] Code: 75 f7 48 83 c6 01 0f b6 4e ff 48 83 c2 01 84 c9 
> 88 4a ff 75 ed f3 c3 0f 1f 80 00 00 00 00 48 83 c7 01 0f b6 47 ff 48 
> 83 c6 01 <3a> 46 ff 75 07 84 c0 75 eb 31 c0 c3 19 c0 83 c8 01 c3 66 90 
> 48 85
> [    2.687877] RSP: 0018:ffff9fadc104bb18 EFLAGS: 00010202
> [    2.687880] RAX: 0000000000000065 RBX: ffff9d6834ba5428 RCX: 
> 0000000000000001
> [    2.687882] RDX: ffffffffc0288d00 RSI: 0000000000000001 RDI: 
> ffff9d68351b5a61
> [    2.687883] RBP: 0000000000000000 R08: 0000000000000001 R09: 
> ffff9d6836dbfd80
> [    2.687885] R10: 0000000000000000 R11: ffff9d6835e65648 R12: 
> 0000000000000000
> [    2.687887] R13: 0000000000000000 R14: 0000000000000000 R15: 
> ffff9fadc104be98
> [    2.687889] FS:  00007f976806a8c0(0000) GS:ffff9d6838a80000(0000) 
> knlGS:0000000000000000
> [    2.687891] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [    2.687893] CR2: 0000000000000000 CR3: 00000002b4286002 CR4: 
> 00000000003606e0
> [    2.687895] Call Trace:
> [    2.687902]  soc_find_component+0x4c/0x70 [snd_soc_core]
> [    2.687908]  soc_init_dai_link+0x124/0x280 [snd_soc_core]
> [    2.687913]  snd_soc_register_card+0x6b/0x1f0 [snd_soc_core]
> [    2.687918]  ? __devres_alloc_node+0x2c/0x60
> [    2.687922]  devm_snd_soc_register_card+0x3e/0x80 [snd_soc_core]
> [    2.687926]  platform_drv_probe+0x35/0x90
> [    2.687930]  ? driver_sysfs_add+0x70/0xd0
> [    2.687932]  really_probe+0xee/0x2e0
> [    2.687935]  driver_probe_device+0x4a/0xe0
> [    2.687938]  __driver_attach+0xac/0xb0
> [    2.687941]  ? driver_probe_device+0xe0/0xe0
> [    2.687943]  bus_for_each_dev+0x71/0xb0
> [    2.687946]  bus_add_driver+0x191/0x210
> [    2.687948]  ? 0xffffffffc01bf000
> [    2.687951]  driver_register+0x56/0xe0
> [    2.687953]  ? 0xffffffffc01bf000
> [    2.687956]  do_one_initcall+0x41/0x1b8
> [    2.687960]  ? kobject_uevent_env+0x101/0x680
> [    2.687962]  ? _cond_resched+0x10/0x40
> [    2.687966]  ? kmem_cache_alloc_trace+0x35/0x160
> [    2.687969]  do_init_module+0x56/0x1db
> [    2.687973]  load_module+0x1e7c/0x2560
> [    2.687976]  ? vfs_read+0x10a/0x130
> [    2.687979]  ? __do_sys_finit_module+0xba/0xe0
> [    2.687983]  __do_sys_finit_module+0xba/0xe0
> [    2.687988]  do_syscall_64+0x43/0xf0
> [    2.687992]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
> [    2.687995] RIP: 0033:0x7f9768aef219
> [    2.687998] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 
> 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 
> 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 47 fc 0c 00 f7 d8 64 89 
> 01 48
> [    2.688000] RSP: 002b:00007ffccf3a4c98 EFLAGS: 00000246 ORIG_RAX: 
> 0000000000000139
> [    2.688003] RAX: ffffffffffffffda RBX: 000055991cf57970 RCX: 
> 00007f9768aef219
> [    2.688006] RDX: 0000000000000000 RSI: 00007f97689d3cad RDI: 
> 000000000000000f
> [    2.688008] RBP: 00007f97689d3cad R08: 0000000000000000 R09: 
> 0000000000000000
> [    2.688010] R10: 000000000000000f R11: 0000000000000246 R12: 
> 0000000000000000
> [    2.688012] R13: 000055991cf49930 R14: 0000000000020000 R15: 
> 000055991cf57970
> [    2.688015] Modules linked in: snd_soc_skl_hda_dsp(+) 
> snd_soc_hdac_hdmi snd_soc_dmic ax88179_178a(+) usbnet 
> snd_hda_codec_realtek snd_hda_codec_generic snd_soc_skl 
> snd_soc_hdac_hda snd_hda_ext_core snd_soc_skl_ipc x86_pkg_temp_thermal 
> snd_soc_sst_ipc snd_soc_sst_dsp snd_soc_acpi_intel_match snd_soc_acpi 
> snd_soc_core snd_compress snd_hda_codec snd_hwdep snd_hda_core snd_pcm 
> efivarfs intel_lpss_pci xhci_pci intel_lpss mfd_core xhci_hcd
> [    2.688031] CR2: 0000000000000000
> [    2.688034] ---[ end trace 8b96d01935d9effd ]---
> [    2.688037] RIP: 0010:strcmp+0xc/0x20
> [    2.688039] Code: 75 f7 48 83 c6 01 0f b6 4e ff 48 83 c2 01 84 c9 
> 88 4a ff 75 ed f3 c3 0f 1f 80 00 00 00 00 48 83 c7 01 0f b6 47 ff 48 
> 83 c6 01 <3a> 46 ff 75 07 84 c0 75 eb 31 c0 c3 19 c0 83 c8 01 c3 66 90 
> 48 85
> [    2.688042] RSP: 0018:ffff9fadc104bb18 EFLAGS: 00010202
> [    2.688044] RAX: 0000000000000065 RBX: ffff9d6834ba5428 RCX: 
> 0000000000000001
> [    2.688046] RDX: ffffffffc0288d00 RSI: 0000000000000001 RDI: 
> ffff9d68351b5a61
> [    2.688048] RBP: 0000000000000000 R08: 0000000000000001 R09: 
> ffff9d6836dbfd80
> [    2.688050] R10: 0000000000000000 R11: ffff9d6835e65648 R12: 
> 0000000000000000
> [    2.688052] R13: 0000000000000000 R14: 0000000000000000 R15: 
> ffff9fadc104be98
> [    2.688055] FS:  00007f976806a8c0(0000) GS:ffff9d6838a80000(0000) 
> knlGS:0000000000000000
> [    2.688057] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [    2.688059] CR2: 0000000000000000 CR3: 00000002b4286002 CR4: 
> 00000000003606e0
>
Thanks,

Rohit
diff mbox series

Patch

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 0462b3e..eec92f1 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1027,7 +1027,6 @@  static int snd_soc_init_platform(struct snd_soc_card *card,
 				 struct snd_soc_dai_link *dai_link)
 {
 	struct snd_soc_dai_link_component *platform = dai_link->platform;
-
 	/*
 	 * FIXME
 	 *
@@ -1129,6 +1128,14 @@  static int soc_init_dai_link(struct snd_soc_card *card,
 			link->name);
 		return -EINVAL;
 	}
+
+	/*
+	 * Defer card registartion if platform dai component is not added to
+	 * component list.
+	 */
+	if (!soc_find_component(link->platform->of_node, link->platform->name))
+		return -EPROBE_DEFER;
+
 	/*
 	 * CPU device may be specified by either name or OF node, but
 	 * can be left unspecified, and will be matched based on DAI
@@ -1140,6 +1147,14 @@  static int soc_init_dai_link(struct snd_soc_card *card,
 			link->name);
 		return -EINVAL;
 	}
+
+	/*
+	 * Defer card registartion if cpu dai component is not added to
+	 * component list.
+	 */
+	if (!soc_find_component(link->cpu_of_node, link->cpu_name))
+		return -EPROBE_DEFER;
+
 	/*
 	 * At least one of CPU DAI name or CPU device name/node must be
 	 * specified