
<     struct usb_device *hdev = to_usb_device(dev->parent->parent);
<     struct usb_hub *hub = usb_hub_to_struct_hub(hdev);
<     struct usb_interface *intf = to_usb_interface(hub->intfdev);
---
>     if (dev == NULL || dev->parent == NULL || dev->parent->parent == NULL) {
>         return -EINVAL;
>     }
>     struct usb_device *hdev = to_usb_device(dev->parent->parent);
>     if (hdev == NULL) {
>         return -ENODEV;
>     }
>     struct usb_hub *hub = usb_hub_to_struct_hub(hdev);
>     if (hub == NULL) {
>         return -ENODEV;
>     }
>     struct usb_interface *intf = to_usb_interface(hub->intfdev);
