From: Ping Cheng Date: Fri, 7 Nov 2014 01:30:51 +0000 (-0800) Subject: HID: wacom - make sure touch_input is valid before using it X-Git-Tag: v3.19-rc1~105^2^10~13 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=44b9683853c7b47d039366d7d2fd0d5380aba276;p=karo-tx-linux.git HID: wacom - make sure touch_input is valid before using it touch_input is stored in wacom_shared for pen data to report touch switch status. It is possible, although we didn't see it happen on Linux yet, that pen data is procesed before touch interface is fully probed. As a by-product of this patch, it fixes the FreeBSD issue reported by Denis Akiyakov http://www.spinics.net/lists/linux-input/msg33971.html Reviewed-by: Hans Petter Selasky Tested-by: Denis Akiyakov 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 586b2405b0d4..d343a6ee5bf7 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1681,7 +1681,9 @@ static int wacom_bpt_pen(struct wacom_wac *wacom) return 0; if (data[0] == WACOM_REPORT_USB) { - if (features->type == INTUOSHT && features->touch_max) { + if (features->type == INTUOSHT && + wacom->shared->touch_input && + features->touch_max) { input_report_switch(wacom->shared->touch_input, SW_MUTE_DEVICE, data[8] & 0x40); input_sync(wacom->shared->touch_input); @@ -1774,7 +1776,8 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len) int pid, battery, ps_connected; if ((wacom->shared->type == INTUOSHT) && - wacom->shared->touch_max) { + wacom->shared->touch_input && + wacom->shared->touch_max) { input_report_switch(wacom->shared->touch_input, SW_MUTE_DEVICE, data[5] & 0x40); input_sync(wacom->shared->touch_input);