aboutsummaryrefslogtreecommitdiff
path: root/hid-tmt248.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-03-23 22:39:07 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2022-03-24 11:30:47 +0200
commit3865f5c94cb90d16810b7e751fa79034321ea836 (patch)
tree67f44fc695189ae3ac28a931b6856991535167fe /hid-tmt248.c
parentfed8081d45d05ecf2b557515e17a5005b90a7e96 (diff)
downloadhid-tmff2-3865f5c94cb90d16810b7e751fa79034321ea836.tar.gz
hid-tmff2-3865f5c94cb90d16810b7e751fa79034321ea836.zip
fixed possible kernel oops when unplugging device
Diffstat (limited to 'hid-tmt248.c')
-rw-r--r--hid-tmt248.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/hid-tmt248.c b/hid-tmt248.c
index f3d4700..839f670 100644
--- a/hid-tmt248.c
+++ b/hid-tmt248.c
@@ -254,19 +254,21 @@ static int t248_open(void *data)
return t248->open(t248->input_dev);
}
-static int t248_close(void *data)
+static int t248_close(void *data, int dev_accessible)
{
struct t300rs_device_entry *t248 = data;
if (!t248)
return -ENODEV;
- t248->send_buffer[0] = 0x01;
- t248->send_buffer[1] = 0x05;
- t300rs_send_int(t248);
+ if (dev_accessible) {
+ t248->send_buffer[0] = 0x01;
+ t248->send_buffer[1] = 0x05;
+ t300rs_send_int(t248);
- t248->send_buffer[0] = 0x01;
- t248->send_buffer[1] = 0x00;
- t300rs_send_int(t248);
+ t248->send_buffer[0] = 0x01;
+ t248->send_buffer[1] = 0x00;
+ t300rs_send_int(t248);
+ }
t248->close(t248->input_dev);
return 0;