]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commit
ASoC: tegra-alt: Fix crash when 'rt565x-playback' link is not defined
authorJon Hunter <jonathanh@nvidia.com>
Wed, 10 Jan 2018 09:49:29 +0000 (09:49 +0000)
committermobile promotions <svcmobile_promotions@nvidia.com>
Mon, 15 Jan 2018 14:01:19 +0000 (06:01 -0800)
commit9bcd460c93a25ecb4b108fc862a7ff93bcc57128
treed1e3a51d626e9f897ae327a2efa837eab56f9d67
parent678c603ddff1eb7da52a108d0e26be45699219d4
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
Tegra210 rt565x machine driver then the following crash is seen ...

 Unable to handle kernel NULL pointer dereference at virtual address 00000068
 pgd = ffffffc00163e000
 [00000068] *pgd=000000017b1d8003, *pud=000000017b1d8003, *pmd=000000017b1d9003, *pte=00e8000050041707
 Internal error: Oops: 96000005 [#1] PREEMPT SMP
 Modules linked in:
 CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.4.38-tegra #222
 Hardware name: jetson_tx1 (DT)
 task: ffffffc0fb2f0000 ti: ffffffc0fb2a4000 task.ti: ffffffc0fb2a4000
 PC is at rt5659_set_jack_detect+0x8/0x2c
 LR is at tegra_t210ref_driver_probe+0x248/0x284
 pc : [<ffffffc0009b3864>] lr : [<ffffffc0009c5a60>] pstate: 60000045
 sp : ffffffc0fb2a7bf0
 x29: ffffffc0fb2a7bf0 x28: 0000000000000000 
 x27: 0000000000000000 x26: 0000000000000000 
 x25: 0000000000000000 x24: 0000000000000000 
 x23: 0000000000000000 x22: 0000000000000000 
 x21: ffffffc0fa282010 x20: ffffffc07d136c18 
 x19: ffffffc07d136c20 x18: 0000000000000000 
 x17: 0000000000000000 x16: 0000000000000000 
 x15: 0000000000000008 x14: 66656420746f6e20 
 x13: 6b6e696c20636564 x12: 6f63203a646e756f 
 x11: 7320783536357472 x10: 2d656c69626f6d2d 
 x9 : 666572303132742d x8 : ffffffc00030e7c8 
 x7 : 0000000000000000 x6 : 000000000000006c 
 x5 : 0000000000000000 x4 : ffffffc0fb2a78e0 
 x3 : 0000000000000000 x2 : 0000000000000c16 
 x1 : ffffffc001622228 x0 : 0000000000000000 
 
 Process swapper/0 (pid: 1, stack limit = 0xffffffc0fb2a4020)
 Call trace:
 [<ffffffc0009b3864>] rt5659_set_jack_detect+0x8/0x2c
 [<ffffffc0009c5a60>] tegra_t210ref_driver_probe+0x248/0x284
 [<ffffffc0006323c4>] platform_drv_probe+0x4c/0xb4
 [<ffffffc00062fd44>] really_probe+0x138/0x2f0
 [<ffffffc00062fff0>] driver_probe_device+0x8c/0xcc
 [<ffffffc000630090>] __driver_attach+0x60/0x8c
 [<ffffffc00062de50>] bus_for_each_dev+0x54/0x94
 [<ffffffc00062f938>] driver_attach+0x20/0x28
 [<ffffffc00062f280>] bus_add_driver+0x144/0x230
 [<ffffffc000630fd4>] driver_register+0x90/0xd8
 [<ffffffc000632324>] __platform_driver_register+0x54/0x5c
 [<ffffffc001296918>] tegra_t210ref_driver_init+0x18/0x20
 [<ffffffc0000810d8>] do_one_initcall+0x4c/0xf0
 [<ffffffc001245b64>] do_initcall_level+0xa0/0xc0
 [<ffffffc001245b9c>] do_initcalls+0x18/0x30
 [<ffffffc001245bd8>] do_basic_setup+0x24/0x30
 [<ffffffc001245d10>] kernel_init_freeable+0x118/0x1ac
 [<ffffffc000bc1ba8>] kernel_init+0xc/0xe8
 [<ffffffc000084790>] ret_from_fork+0x10/0x40
 ---[ end trace 783136a9ec7cad16 ]---

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: Ib8945fee1abe1745c1b087605bf876341b3ad367
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1636468
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>
sound/soc/tegra-alt/tegra_t210ref_mobile_rt565x_alt.c