@@ -726,7 +726,7 @@ static void wacom_retrieve_hid_descriptor(struct hid_device *hdev,
726
726
* Skip the query for this type and modify defaults based on
727
727
* interface number.
728
728
*/
729
- if (features -> type == WIRELESS ) {
729
+ if (features -> type == WIRELESS && intf ) {
730
730
if (intf -> cur_altsetting -> desc .bInterfaceNumber == 0 )
731
731
features -> device_type = WACOM_DEVICETYPE_WL_MONITOR ;
732
732
else
@@ -2451,6 +2451,9 @@ static void wacom_wireless_work(struct work_struct *work)
2451
2451
2452
2452
wacom_destroy_battery (wacom );
2453
2453
2454
+ if (!usbdev )
2455
+ return ;
2456
+
2454
2457
/* Stylus interface */
2455
2458
hdev1 = usb_get_intfdata (usbdev -> config -> interface [1 ]);
2456
2459
wacom1 = hid_get_drvdata (hdev1 );
@@ -2730,8 +2733,6 @@ static void wacom_mode_change_work(struct work_struct *work)
2730
2733
static int wacom_probe (struct hid_device * hdev ,
2731
2734
const struct hid_device_id * id )
2732
2735
{
2733
- struct usb_interface * intf = to_usb_interface (hdev -> dev .parent );
2734
- struct usb_device * dev = interface_to_usbdev (intf );
2735
2736
struct wacom * wacom ;
2736
2737
struct wacom_wac * wacom_wac ;
2737
2738
struct wacom_features * features ;
@@ -2766,8 +2767,14 @@ static int wacom_probe(struct hid_device *hdev,
2766
2767
wacom_wac -> hid_data .inputmode = -1 ;
2767
2768
wacom_wac -> mode_report = -1 ;
2768
2769
2769
- wacom -> usbdev = dev ;
2770
- wacom -> intf = intf ;
2770
+ if (hid_is_usb (hdev )) {
2771
+ struct usb_interface * intf = to_usb_interface (hdev -> dev .parent );
2772
+ struct usb_device * dev = interface_to_usbdev (intf );
2773
+
2774
+ wacom -> usbdev = dev ;
2775
+ wacom -> intf = intf ;
2776
+ }
2777
+
2771
2778
mutex_init (& wacom -> lock );
2772
2779
INIT_DELAYED_WORK (& wacom -> init_work , wacom_init_work );
2773
2780
INIT_WORK (& wacom -> wireless_work , wacom_wireless_work );
0 commit comments