Here is the deal:

we have a guy here with a webcam and the following scenario:
1. ov511 disconnects, everything dies/releases/closes fine,
2. webcam soft starts polling open/sleep/open/sleep/...
3. ov511_probe works and reaches ov511_configure,
   calls video_register_device().
4. Webcam software opens and oopses on the semafore
   that was not initialized yet.

I think video_register_device needs to be done last, when
everything else is ready to accept appliction requests.

Someone please review. The error handling style
of ov511 spins my head. I may be missing a code path somewhere.

Thanks in advance,
-- Pete

--- linux-2.4.2-ac19/drivers/usb/ov511.c        Thu Jan  4 13:15:32 2001
+++ linux-2.4.2-ac19-p3/drivers/usb/ov511.c     Thu Mar 22 19:55:59 2001
@@ -3141,11 +3141,6 @@
 
        init_waitqueue_head(&ov511->wq);
 
-       if (video_register_device(&ov511->vdev, VFL_TYPE_GRABBER) < 0) {
-               err("video_register_device failed");
-               return -EBUSY;
-       }
-
        if (ov511_write_regvals(dev, aRegvalsInit)) goto error;
        if (ov511_write_regvals(dev, aRegvalsNorm511)) goto error;
 
@@ -3214,7 +3209,6 @@
        return 0;
        
 error:
-       video_unregister_device(&ov511->vdev);
        usb_driver_release_interface(&ov511_driver,
                &dev->actconfig->interface[ov511->iface]);
 
@@ -3323,6 +3317,11 @@
                ov511->buf_state = BUF_NOT_ALLOCATED;
        } else {
                err("Failed to configure camera");
+               goto error;
+       }
+
+       if (video_register_device(&ov511->vdev, VFL_TYPE_GRABBER) < 0) {
+               err("video_register_device failed");
                goto error;
        }
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to