From: Laurent Pinchart Date: Tue, 25 Oct 2011 12:03:42 +0000 (-0300) Subject: [media] uvcvideo: Handle uvc_init_video() failure in uvc_video_enable() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=24c3aae0c740ae9837284266ea82234415721dc1;p=mv-sheeva.git [media] uvcvideo: Handle uvc_init_video() failure in uvc_video_enable() 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 Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c index 2995f26ccae..2e5e72825ad 100644 --- a/drivers/media/video/uvc/uvc_video.c +++ b/drivers/media/video/uvc/uvc_video.c @@ -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; +}