ASoC: tegra-alt: Fix crash when 'rt565x-playback' link is not defined
If the 'rt565x-playback' link is not defined in device-tree for the
Tegra186 rt565x machine driver then the following crash is seen ...
Unable to handle kernel NULL pointer dereference at virtual address
00000068
pgd =
ffffffc0014f1000
[
00000068] *pgd=000000026cdd6003, *pud=000000026cdd6003, *pmd=000000026cdd7003, *pte=00e8000003881707
Internal error: Oops:
96000005 [#1] PREEMPT SMP
Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.4.38-tegra #116
Hardware name: quill (DT)
task:
ffffffc1ece78000 ti: ffffffc1ece80000 task.ti: ffffffc1ece80000
PC is at rt5659_set_jack_detect+0x8/0x38
LR is at tegra_t186ref_driver_probe+0x4a8/0x4f8
pc : [<
ffffffc0009a1e94>] lr : [<ffffffc0009bad8c>] pstate: 60000045
sp :
ffffffc1ece83b80
x29:
ffffffc1ece83b80 x28: ffffffc1e1beb118
x27:
000000000000000d x26: ffffffc0013dabd8
x25:
ffffffc1e1bec218 x24: ffffffc1e1beb118
x23:
0000000000000000 x22: ffffffc1e1beb120
x21:
0000000000000000 x20: ffffffc1ebb4ac10
x19:
ffffffc0013da940 x18: 0000000000000000
x17:
ffffffc000b85a60 x16: ffffffc000b85a60
x15:
ffffffc000b85a60 x14: 6b6e696c20636564
x13:
6f63203a646e756f x12: 7320783536357472
x11:
2d656c69626f6d2d x10: 666572363831742d
x9 :
00000000000002ca x8 : 0000000000000001
x7 :
ffffffc1ece80000 x6 : 0000000000000000
x5 :
0000000000000000 x4 : 0000000000000000
x3 :
0000000000000000 x2 : 0000000000000000
x1 :
ffffffc0014d6150 x0 : 0000000000000000
Process swapper/0 (pid: 1, stack limit = 0x
ffffffc1ece80020)
Call trace:
[<
ffffffc0009a1e94>] rt5659_set_jack_detect+0x8/0x38
[<
ffffffc0009bad8c>] tegra_t186ref_driver_probe+0x4a8/0x4f8
[<
ffffffc000597518>] platform_drv_probe+0x50/0xbc
[<
ffffffc000594fa8>] driver_probe_device+0xc8/0x408
[<
ffffffc000595384>] __driver_attach+0x9c/0xa0
[<
ffffffc000593004>] bus_for_each_dev+0x58/0x98
[<
ffffffc000594a30>] driver_attach+0x20/0x28
[<
ffffffc0005945a0>] bus_add_driver+0x1f0/0x294
[<
ffffffc000596204>] driver_register+0x68/0x108
[<
ffffffc00059745c>] __platform_driver_register+0x54/0x5c
[<
ffffffc00117b880>] tegra_t186ref_driver_init+0x1c/0x24
[<
ffffffc000081ab4>] do_one_initcall+0xc8/0x1c0
[<
ffffffc00112fb70>] kernel_init_freeable+0x1dc/0x280
[<
ffffffc000b74b8c>] kernel_init+0x10/0xe0
[<
ffffffc000084f90>] ret_from_fork+0x10/0x40
---[ end trace
0cb34349b16e5280 ]---
This crash is caused because when the 'rt565x-playback' link is not
defined we will still call rt5659_set_jack_detect() but pass a NULL
pointer for the codec handle. Fix this by ensuring we only call
rt5659_set_jack_detect() when the 'rt565x-playback' link is present.
Bug 2045523
Change-Id: I
4c6a57ae5df6e1c976c81ff0557534eecea581bc
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1636472
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>