summaryrefslogtreecommitdiff
path: root/drivers/hid
diff options
context:
space:
mode:
authorPing Cheng <pinglinux@gmail.com>2016-12-09 09:04:52 +0300
committerJiri Kosina <jkosina@suse.cz>2016-12-09 15:26:24 +0300
commit6f46cf9b40df7d181f11989bab6f4cc08787cdfe (patch)
tree0ea166bcc25918006a1fd5a8232e2aae1707032b /drivers/hid
parent354a32985a863c9eecd381a5f9eea480d5abc6dc (diff)
downloadlinux-6f46cf9b40df7d181f11989bab6f4cc08787cdfe.tar.xz
HID: wacom: generic: Send data only when the interface is defined
Sometime valid events may not be supported by the driver yet. Make sure we don't process them when the code is not ready. This fix prevents a kernel panic due to unsupported HID events. Signed-off-by: Ping Cheng <ping.cheng@wacom.com> Reviewed-By: Jason Gerecke <jason.gerecke@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/wacom_wac.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index f1c49a44c06a..29d261042fb2 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -2109,11 +2109,11 @@ void wacom_wac_event(struct hid_device *hdev, struct hid_field *field,
if (wacom->wacom_wac.features.type != HID_GENERIC)
return;
- if (WACOM_PAD_FIELD(field))
+ if (WACOM_PAD_FIELD(field) && wacom->wacom_wac.pad_input)
wacom_wac_pad_event(hdev, field, usage, value);
- else if (WACOM_PEN_FIELD(field))
+ else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input)
wacom_wac_pen_event(hdev, field, usage, value);
- else if (WACOM_FINGER_FIELD(field))
+ else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input)
wacom_wac_finger_event(hdev, field, usage, value);
}
@@ -2145,20 +2145,20 @@ void wacom_wac_report(struct hid_device *hdev, struct hid_report *report)
if (wacom_wac->features.type != HID_GENERIC)
return;
- if (WACOM_PAD_FIELD(field))
+ if (WACOM_PAD_FIELD(field) && wacom->wacom_wac.pad_input)
wacom_wac_pad_pre_report(hdev, report);
- else if (WACOM_PEN_FIELD(field))
+ else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input)
wacom_wac_pen_pre_report(hdev, report);
- else if (WACOM_FINGER_FIELD(field))
+ else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input)
wacom_wac_finger_pre_report(hdev, report);
wacom_report_events(hdev, report);
- if (WACOM_PAD_FIELD(field))
+ if (WACOM_PAD_FIELD(field) && wacom->wacom_wac.pad_input)
return wacom_wac_pad_report(hdev, report);
- else if (WACOM_PEN_FIELD(field))
+ else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input)
return wacom_wac_pen_report(hdev, report);
- else if (WACOM_FINGER_FIELD(field))
+ else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input)
return wacom_wac_finger_report(hdev, report);
}