struct usb_host_interface *iface_desc;
        struct usb_endpoint_descriptor *endpoint;
        int retval = -ENOMEM;
-       int i;
        DEFINE_WAIT(wait);
+       int res;
 
        /* allocate memory for our device state and initialize it */
        dev = kzalloc(sizeof(*dev), GFP_KERNEL);
 
        /* set up the endpoint information */
        iface_desc = interface->cur_altsetting;
-       for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
-               endpoint = &iface_desc->endpoint[i].desc;
-
-               if (usb_endpoint_is_int_in(endpoint)) {
-                       dev->int_in_endpointAddr = endpoint->bEndpointAddress;
-                       break;
-               }
-       }
-       if (!dev->int_in_endpointAddr) {
-               retval = -ENODEV;
+       res = usb_find_int_in_endpoint(iface_desc, &endpoint);
+       if (res) {
                dev_err(&interface->dev, "Could not find endpoints\n");
+               retval = res;
                goto error;
        }
 
+       dev->int_in_endpointAddr = endpoint->bEndpointAddress;
 
        /* allocate control URB */
        dev->cntl_urb = usb_alloc_urb(0, GFP_KERNEL);