]> rtime.felk.cvut.cz Git - linux-imx.git/blobdiff - drivers/media/usb/hdpvr/hdpvr-core.c
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
[linux-imx.git] / drivers / media / usb / hdpvr / hdpvr-core.c
index 8247c19d62603cd4fbf977f010e28ea92ba6b045..6e5070774dc2ca480fe3970c75bb79c0a893e47b 100644 (file)
@@ -220,7 +220,6 @@ static int hdpvr_device_init(struct hdpvr_device *dev)
 {
        int ret;
        u8 *buf;
-       struct hdpvr_video_info *vidinf;
 
        if (device_authorization(dev))
                return -EACCES;
@@ -242,13 +241,6 @@ static int hdpvr_device_init(struct hdpvr_device *dev)
                 "control request returned %d\n", ret);
        mutex_unlock(&dev->usbc_mutex);
 
-       vidinf = get_video_info(dev);
-       if (!vidinf)
-               v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
-                       "no valid video signal or device init failed\n");
-       else
-               kfree(vidinf);
-
        /* enable fan and bling leds */
        mutex_lock(&dev->usbc_mutex);
        buf[0] = 0x1;
@@ -311,6 +303,11 @@ static int hdpvr_probe(struct usb_interface *interface,
 
        dev->workqueue = 0;
 
+       /* init video transfer queues first of all */
+       /* to prevent oops in hdpvr_delete() on error paths */
+       INIT_LIST_HEAD(&dev->free_buff_list);
+       INIT_LIST_HEAD(&dev->rec_buff_list);
+
        /* register v4l2_device early so it can be used for printks */
        if (v4l2_device_register(&interface->dev, &dev->v4l2_dev)) {
                dev_err(&interface->dev, "v4l2_device_register failed\n");
@@ -333,10 +330,6 @@ static int hdpvr_probe(struct usb_interface *interface,
        if (!dev->workqueue)
                goto error;
 
-       /* init video transfer queues */
-       INIT_LIST_HEAD(&dev->free_buff_list);
-       INIT_LIST_HEAD(&dev->rec_buff_list);
-
        dev->options = hdpvr_default_options;
 
        if (default_video_input < HDPVR_VIDEO_INPUTS)
@@ -413,7 +406,7 @@ static int hdpvr_probe(struct usb_interface *interface,
                                    video_nr[atomic_inc_return(&dev_nr)]);
        if (retval < 0) {
                v4l2_err(&dev->v4l2_dev, "registering videodev failed\n");
-               goto error;
+               goto reg_fail;
        }
 
        /* let the user know what node this device is now attached to */