From: Ping Cheng Date: Wed, 20 May 2015 00:42:02 +0000 (-0700) Subject: HID: wacom: fix an Oops caused by wacom_wac_finger_count_touches X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=26ba61f871b4aa9958bcebffcbeb558094d75928;p=openwrt%2Fstaging%2Fblogic.git HID: wacom: fix an Oops caused by wacom_wac_finger_count_touches We assumed all touch interfaces report touch data. But, Bamboo and Intuos non-touch devices report express keys on touch interface. We need to check touch_max before counting touches. Reported-by: Tasos Sahanidis Signed-off-by: Ping Cheng Signed-off-by: Jiri Kosina --- diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index fa54d3290659..adf959dcfa5d 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1072,6 +1072,9 @@ static int wacom_wac_finger_count_touches(struct wacom_wac *wacom) int count = 0; int i; + if (!touch_max) + return 0; + /* non-HID_GENERIC single touch input doesn't call this routine */ if ((touch_max == 1) && (wacom->features.type == HID_GENERIC)) return wacom->hid_data.tipswitch &&