diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-03-23 22:39:07 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-03-24 11:30:47 +0200 |
| commit | 3865f5c94cb90d16810b7e751fa79034321ea836 (patch) | |
| tree | 67f44fc695189ae3ac28a931b6856991535167fe /hid-tmt248.c | |
| parent | fed8081d45d05ecf2b557515e17a5005b90a7e96 (diff) | |
| download | hid-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.c | 16 |
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; |
