
<     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);
---
>     struct usb_device *hdev;
>     struct usb_hub *hub;
>     struct usb_interface *intf;
>     
>     if (dev == NULL || dev->parent == NULL || dev->parent->parent == NULL)
>         goto error;
>     
>     hdev = to_usb_device(dev->parent->parent);
>     if (hdev == NULL)
>         goto error;
>     
>     hub = usb_hub_to_struct_hub(hdev);
>     if (hub == NULL)
>         goto error;
>     
>     intf = to_usb_interface(hub->intfdev);
>     if (intf == NULL)
>         goto error;
>     
>     // Rest of the function
>     
> error:
>     return -ENODEV;
