From 573fd6c3bf64cb58113939da364c70169c82bc0d Mon Sep 17 00:00:00 2001 From: Himanshu Agrawal Date: Tue, 17 Mar 2020 11:21:30 +0530 Subject: [PATCH] input: synaptics_dsx_2.6: Add check for stylus device If stylus_enable is true and sytlus device is NULL, it is resulting in crash while reporting input events. So, check for existence of stylus device as well along with stylus_enable. Change-Id: I6679ff03f7cd4a8e587d0f4e8f794141b2cddd45 Signed-off-by: Himanshu Agrawal Signed-off-by: Manjunatha Madana --- .../input/touchscreen/synaptics_dsx_2.6/synaptics_dsx_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/synaptics_dsx_2.6/synaptics_dsx_core.c b/drivers/input/touchscreen/synaptics_dsx_2.6/synaptics_dsx_core.c index 21236e9bf192..dd7226157f39 100644 --- a/drivers/input/touchscreen/synaptics_dsx_2.6/synaptics_dsx_core.c +++ b/drivers/input/touchscreen/synaptics_dsx_2.6/synaptics_dsx_core.c @@ -1471,7 +1471,7 @@ static int synaptics_rmi4_f12_abs_report(struct synaptics_rmi4_data *rmi4_data, input_mt_sync(rmi4_data->input_dev); #endif - if (rmi4_data->stylus_enable) { + if (rmi4_data->stylus_enable && rmi4_data->stylus_dev) { stylus_presence = 0; input_report_key(rmi4_data->stylus_dev, BTN_TOUCH, 0); @@ -3624,7 +3624,7 @@ static int synaptics_rmi4_free_fingers(struct synaptics_rmi4_data *rmi4_data) #endif input_sync(rmi4_data->input_dev); - if (rmi4_data->stylus_enable) { + if (rmi4_data->stylus_enable && rmi4_data->stylus_dev) { input_report_key(rmi4_data->stylus_dev, BTN_TOUCH, 0); input_report_key(rmi4_data->stylus_dev,