diff options
Diffstat (limited to 'drivers/hid/usbhid/hiddev.c')
-rw-r--r-- | drivers/hid/usbhid/hiddev.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index 254a003af048..f2850171a69b 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c | |||
@@ -587,7 +587,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
587 | struct hiddev_list *list = file->private_data; | 587 | struct hiddev_list *list = file->private_data; |
588 | struct hiddev *hiddev = list->hiddev; | 588 | struct hiddev *hiddev = list->hiddev; |
589 | struct hid_device *hid = hiddev->hid; | 589 | struct hid_device *hid = hiddev->hid; |
590 | struct usb_device *dev = hid_to_usb_dev(hid); | 590 | struct usb_device *dev; |
591 | struct hiddev_collection_info cinfo; | 591 | struct hiddev_collection_info cinfo; |
592 | struct hiddev_report_info rinfo; | 592 | struct hiddev_report_info rinfo; |
593 | struct hiddev_field_info finfo; | 593 | struct hiddev_field_info finfo; |
@@ -601,9 +601,11 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
601 | /* Called without BKL by compat methods so no BKL taken */ | 601 | /* Called without BKL by compat methods so no BKL taken */ |
602 | 602 | ||
603 | /* FIXME: Who or what stop this racing with a disconnect ?? */ | 603 | /* FIXME: Who or what stop this racing with a disconnect ?? */ |
604 | if (!hiddev->exist) | 604 | if (!hiddev->exist || !hid) |
605 | return -EIO; | 605 | return -EIO; |
606 | 606 | ||
607 | dev = hid_to_usb_dev(hid); | ||
608 | |||
607 | switch (cmd) { | 609 | switch (cmd) { |
608 | 610 | ||
609 | case HIDIOCGVERSION: | 611 | case HIDIOCGVERSION: |