Browse Source

[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 <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Laurent Pinchart 13 years ago
parent
commit
24c3aae0c7
1 changed files with 7 additions and 2 deletions
  1. 7 2
      drivers/media/video/uvc/uvc_video.c

+ 7 - 2
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;
+}