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 <hagraw@codeaurora.org>
Signed-off-by: Manjunatha Madana <mamanj@codeaurora.org>
This commit is contained in:
Himanshu Agrawal 2020-03-17 11:21:30 +05:30 • committed by Chetan C R
commit 573fd6c3bf

View file

@ -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,