Please review patchlet for ov511 (2.4.2-ac19)
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
drivers/usb/ov511.c +5 -6
@@ -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; }