drivers: misc: ti-st: fix null pointer exception in st_kim_ref()
st_kim_ref() does not take care of the fact that platform_get_drvdata() might return NULL. On AM437x EVM, this causes the platform to stop booting as soon as the module is inserted.
This patch fixes the issue by checking for NULL return value. Oops log follows.
I have not tested BT functionality after this patch. But at least the platform boots now.
[ 12.675697] Unable to handle kernel NULL pointer dereference at virtual address 0000005c
[ 12.684310] pgd = c0004000
[ 12.687157] [0000005c] *pgd=00000000
[ 12.690927] Internal error: Oops: 17 [#1] SMP ARM
[ 12.695873] Modules linked in: btwilink bluetooth ti_vpfe dwc3(+) ov2659 videobuf2_core v4l2_common videodev ti_am335x_adc 6lowpan_iphc matrix_keypad panel_dpi kfifo_buf pixcir_i2c_ts media industrialio videobuf2_dma_contig c_can_platform videobuf2_memops dwc3_omap c_can can_dev
[ 12.721969] CPU: 0 PID: 1235 Comm: kworker/u3:0 Not tainted 3.14.25-02445-g9036ac6daed6 #128
[ 12.730937] Workqueue: hci0 hci_power_on [bluetooth]
[ 12.736165] task: ebd93b40 ti: ecd7c000 task.ti: ecd7c000
[ 12.741856] PC is at st_kim_ref+0x30/0x40
[ 12.746071] LR is at st_kim_ref+0x30/0x40
[ 12.750289] pc : [<c03caf58>] lr : [<c03caf58>] psr: a0000013
[ 12.750289] sp : ecd7de08 ip : ecd7de08 fp : ecd7de1c
[ 12.762365] r10: bf1e710c r9 : bf1e70ec r8 : bf1e7964
[ 12.767858] r7 : ebd2fd50 r6 : bf1e7964 r5 : 00000000 r4 : ecd7de24
[ 12.774723] r3 : c0957208 r2 : 00000000 r1 : c0957208 r0 : 00000000
[ 12.781589] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel
[ 12.789274] Control: 10c5387d Table: abde4059 DAC: 00000015
[ 12.795315] Process kworker/u3:0 (pid: 1235, stack limit = 0xecd7c248)
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Gigi Joseph <gigi.joseph@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 file changed