MLK-16262: Input: snvs_pwrkey - move devm_request_irq to the end of probe function
A pending interrupt may cause a kernel panic at system
startup. It is because the necessary data have not been
initialized completely before the interrupt handler is
called.
[ 1.141547] Unable to handle kernel NULL pointer dereference at virtual address
00000048
[ 1.149642] pgd =
ffff000009275000
[ 1.153048] [
00000048] *pgd=
00000000ffffe003[ 1.157148] , *pud=
00000000ffffd003
, *pmd=
0000000000000000[ 1.162660]
[ 1.164164] Internal error: Oops:
96000004 [#1] PREEMPT SMP
[ 1.169740] Modules linked in:
[ 1.172818] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
4.9.11-03067-g40eb128-dirty #112
[ 1.180738] Hardware name: Freescale i.MX8MQ EVK (DT)
[ 1.185794] task:
ffff8000ba0e0000 task.stack:
ffff8000ba0e8000
[ 1.191725] PC is at imx_snvs_pwrkey_interrupt+0x14/0x70
[ 1.197046] LR is at __handle_irq_event_percpu+0x9c/0x128
[ 1.202450] pc : [<
ffff000008849524>] lr : [<
ffff000008101d4c>] pstate:
000001c5
[ 1.209848] sp :
ffff8000bff79ed0
[ 1.213166] x29:
ffff8000bff79ed0 x28:
ffff8000ba0e8000
[ 1.218514] x27:
0000000000000001 x26:
ffff000008e582b8
[ 1.223862] x25:
ffff000009113eaf x24:
ffff8000ba480200
[ 1.229210] x23:
0000000000000021 x22:
ffff8000bff79f8c
[ 1.234557] x21:
0000000000000000 x20:
ffff8000ba480200
[ 1.239906] x19:
0000000000000000 x18:
0000000000000000
[ 1.245253] x17:
0000000000000000 x16:
0000000000000000
[ 1.250600] x15:
0000000000000000 x14:
0000000000000000
[ 1.255947] x13:
0000000000000000 x12:
0000000000000000
[ 1.261293] x11:
0000000000000040 x10:
ffff8000b8000028
[ 1.266642] x9 :
ffff8000b8000130 x8 :
0000000000000000
[ 1.271989] x7 :
ffff8000ba480200 x6 :
ffff8000ba480200
[ 1.277336] x5 :
ffff8000b8000000 x4 :
00008000b6eca000
[ 1.282684] x3 :
0000000000000000 x2 :
ffff000008849510
[ 1.288030] x1 :
0000000000000000 x0 :
0000000000000021
[ 1.293378]
[ 1.294875] Process swapper/0 (pid: 1, stack limit = 0xffff8000ba0e8020)
[ 1.301581] Stack: (0xffff8000bff79ed0 to 0xffff8000ba0ec000)
[ 1.307330] Call trace:
[ 1.309782] Exception stack(0xffff8000bff79d00 to 0xffff8000bff79e30)
[ 1.316229] 9d00:
0000000000000000 0001000000000000 ffff8000bff79ed0 ffff000008849524
[ 1.324065] 9d20:
ffff8000bff79d40 ffff0000080e0830 ffff8000bffaa980 0000000000000000
[ 1.331901] 9d40:
ffff8000bff79d60 ffff0000080e0898 ffff8000bff79d70 ffff0000080f83d8
[ 1.339736] 9d60:
0000000000554179 ffff0000080e097c ffff8000bff79da0 ffff0000080e7ff0
[ 1.347572] 9d80:
ffff8000ba0e0000 0000000000554179 ffff8000bff79dc0 ffff0000080eb20c
[ 1.355408] 9da0:
0000000000000021 0000000000000000 ffff000008849510 0000000000000000
[ 1.363243] 9dc0:
00008000b6eca000 ffff8000b8000000 ffff8000ba480200 ffff8000ba480200
[ 1.371079] 9de0:
0000000000000000 ffff8000b8000130 ffff8000b8000028 0000000000000040
[ 1.378914] 9e00:
0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 1.386748] 9e20:
0000000000000000 0000000000000000
[ 1.391633] [<
ffff000008849524>] imx_snvs_pwrkey_interrupt+0x14/0x70
[ 1.397994] [<
ffff000008101d4c>] __handle_irq_event_percpu+0x9c/0x128
[ 1.404440] [<
ffff000008101df4>] handle_irq_event_percpu+0x1c/0x58
[ 1.410626] [<
ffff000008101e78>] handle_irq_event+0x48/0x78
[ 1.416206] [<
ffff0000081057c0>] handle_fasteoi_irq+0xb8/0x1b0
[ 1.422045] [<
ffff000008100e4c>] generic_handle_irq+0x24/0x38
[ 1.427797] [<
ffff0000081014b4>] __handle_domain_irq+0x5c/0xb8
[ 1.433637] [<
ffff00000808163c>] gic_handle_irq+0xbc/0x168
[ 1.439127] Exception stack(0xffff8000ba0eb9e0 to 0xffff8000ba0ebb10)
[ 1.445574] b9e0:
ffff8000ba48029c 0000000000000040 0000000000000005 0000000000000000
[ 1.453409] ba00:
0000000000000004 000000000000000f ffff8000ba480220 0000000000000000
[ 1.461244] ba20:
0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 1.469080] ba40:
0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 1.476915] ba60:
0000000000000000 0000000000000000 0000000000000000 ffff8000ba837f00
[ 1.484751] ba80:
ffff8000ba480200 0000000000000021 ffff8000ba48029c ffff8000ba480268
[ 1.492586] baa0:
0000000000000000 0000000000000040 ffff8000ba480220 ffff8000ba480220
[ 1.500422] bac0:
0000000000000000 ffff8000ba0ebb10 ffff000008103cb8 ffff8000ba0ebb10
[ 1.508258] bae0:
ffff000008b2b868 0000000040000045 ffff8000ba837f00 ffff8000ba480200
[ 1.516092] bb00:
ffffffffffffffff ffff000008103e18
[ 1.520975] [<
ffff0000080827b0>] el1_irq+0xb0/0x124
[ 1.525863] [<
ffff000008b2b868>] _raw_spin_unlock_irqrestore+0x10/0x48
[ 1.532397] [<
ffff000008104124>] request_threaded_irq+0xec/0x1c0
[ 1.538410] [<
ffff00000810689c>] devm_request_threaded_irq+0x74/0xe0
[ 1.544770] [<
ffff0000088497a8>] imx_snvs_pwrkey_probe+0x178/0x2a8
[ 1.550958] [<
ffff0000085ccaa0>] platform_drv_probe+0x58/0xc0
[ 1.556713] [<
ffff0000085caf54>] driver_probe_device+0x1fc/0x2a8
[ 1.562727] [<
ffff0000085cb0ac>] __driver_attach+0xac/0xb0
[ 1.568220] [<
ffff0000085c8fa4>] bus_for_each_dev+0x64/0xa0
[ 1.573800] [<
ffff0000085ca740>] driver_attach+0x20/0x28
[ 1.579119] [<
ffff0000085ca290>] bus_add_driver+0x110/0x230
[ 1.584698] [<
ffff0000085cb880>] driver_register+0x60/0xf8
[ 1.590190] [<
ffff0000085cc9d8>] __platform_driver_register+0x40/0x48
[ 1.596640] [<
ffff000009027a24>] imx_snvs_pwrkey_driver_init+0x18/0x20
[ 1.603174] [<
ffff0000080830b8>] do_one_initcall+0x38/0x128
[ 1.608754] [<
ffff000008fe0cec>] kernel_init_freeable+0x1a4/0x248
[ 1.614853] [<
ffff000008b26230>] kernel_init+0x10/0x100
[ 1.620084] [<
ffff000008082e80>] ret_from_fork+0x10/0x50
[ 1.625403] Code:
910003fd f9000bf3 f9405833 52800001 (
f9402660)
[ 1.631518] ---[ end trace
7bb9749c5dc6e8f9 ]---
[ 1.636148] Kernel panic - not syncing: Fatal exception in interrupt
Review-by: Frank Li <frank.li@nxp.com>
Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>