diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c index ef241d66562e00950e8979ef4fd0633fd4efdca3..0f43c4292685fcd4bcde4eeeb6268d17a31fe89e 100644 --- a/drivers/hid/hid-rmi.c +++ b/drivers/hid/hid-rmi.c @@ -368,6 +368,11 @@ static int rmi_check_sanity(struct hid_device *hdev, u8 *data, int size) static int rmi_raw_event(struct hid_device *hdev, struct hid_report *report, u8 *data, int size) { + struct rmi_data *hdata = hid_get_drvdata(hdev); + + if (!(hdata->device_flags & RMI_DEVICE)) + return 0; + size = rmi_check_sanity(hdev, data, size); if (size < 2) return 0; @@ -713,9 +718,11 @@ static void rmi_remove(struct hid_device *hdev) { struct rmi_data *hdata = hid_get_drvdata(hdev); - clear_bit(RMI_STARTED, &hdata->flags); - cancel_work_sync(&hdata->reset_work); - rmi_unregister_transport_device(&hdata->xport); + if (hdata->device_flags & RMI_DEVICE) { + clear_bit(RMI_STARTED, &hdata->flags); + cancel_work_sync(&hdata->reset_work); + rmi_unregister_transport_device(&hdata->xport); + } hid_hw_stop(hdev); }