/* Returns NULL on error, a pointer to usb_usbvision else.  */
static struct usb_usbvision* usbvision_alloc(struct usb_device *dev, struct usb_interface *intf)
/* Returns NULL on error, a pointer to usb_usbvision else.  */
static struct usb_usbvision* usbvision_alloc(struct usb_device *dev, struct usb_interface *intf)
{
	struct usb_usbvision *usbvision;
	usbvision = kzalloc(sizeof(struct usb_usbvision), GFP_KERNEL);
	if (usbvision == NULL)
		return NULL;
	usbvision->dev = dev;
	if (v4l2_device_register(&intf->dev, &usbvision->v4l2_dev))
		goto err_free;
	mutex_init(&usbvision->lock);
	usbvision->ctrlUrb = usb_alloc_urb(USBVISION_URB_FRAMES, GFP_KERNEL);
	if (usbvision->ctrlUrb == NULL)
		goto err_unreg;
	init_waitqueue_head(&usbvision->ctrlUrb_wq);
	usbvision_init_powerOffTimer(usbvision);
	return usbvision;
err_unreg:
	v4l2_device_unregister(&usbvision->v4l2_dev);
err_free:
	kfree(usbvision);
	return NULL;
}