]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
[media] uvcvideo: Handle uvc_init_video() failure in uvc_video_enable()
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Tue, 25 Oct 2011 12:03:42 +0000 (09:03 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 11 Dec 2011 13:13:29 +0000 (11:13 -0200)
Turn streaming off (by selecting alternate setting 0) and disable the
video buffers queue in the uvc_video_enable() error path.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/uvc/uvc_video.c

index 2995f26ccae9b2077e1f30a2dcf43f528e84d39f..2e5e72825ad19ca2c1015a82bd9b072b2b4a264c 100644 (file)
@@ -1283,6 +1283,11 @@ int uvc_video_enable(struct uvc_streaming *stream, int enable)
                return ret;
        }
 
-       return uvc_init_video(stream, GFP_KERNEL);
-}
+       ret = uvc_init_video(stream, GFP_KERNEL);
+       if (ret < 0) {
+               usb_set_interface(stream->dev->udev, stream->intfnum, 0);
+               uvc_queue_enable(&stream->queue, 0);
+       }
 
+       return ret;
+}