Hi Hans, Thanks for the comment. On Sunday 21 November 2010 22:23:38 Hans Verkuil wrote: > On Sunday, November 21, 2010 21:32:52 Laurent Pinchart wrote: > > The stream mutex protects access to the struct uvc_streaming ctrl, > > cur_format and cur_frame fields as well as to the hardware probe > > control. Lock it appropriately. > > > > Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> > > --- > > > > drivers/media/video/uvc/uvc_v4l2.c | 76 > > +++++++++++++++++++++++++---------- drivers/media/video/uvc/uvc_video.c > > | 3 - > > drivers/media/video/uvc/uvcvideo.h | 4 +- > > 3 files changed, 57 insertions(+), 26 deletions(-) > > > > diff --git a/drivers/media/video/uvc/uvc_v4l2.c > > b/drivers/media/video/uvc/uvc_v4l2.c index 07dd235..b4615e2 100644 > > --- a/drivers/media/video/uvc/uvc_v4l2.c > > +++ b/drivers/media/video/uvc/uvc_v4l2.c [snip] > > @@ -255,14 +257,21 @@ done: > > static int uvc_v4l2_get_format(struct uvc_streaming *stream, > > > > struct v4l2_format *fmt) > > > > { > > > > - struct uvc_format *format = stream->cur_format; > > - struct uvc_frame *frame = stream->cur_frame; > > + struct uvc_format *format; > > + struct uvc_frame *frame; > > + int ret = 0; > > > > if (fmt->type != stream->type) > > > > return -EINVAL; > > > > - if (format == NULL || frame == NULL) > > - return -EINVAL; > > + mutex_lock(&stream->mutex); > > + format = stream->cur_format; > > + frame = stream->cur_frame; > > + > > + if (format == NULL || frame == NULL) { > > + ret = -EINVAL; > > ret is set... > > > + goto done; > > + } > > > > fmt->fmt.pix.pixelformat = format->fcc; > > fmt->fmt.pix.width = frame->wWidth; > > > > @@ -273,6 +282,8 @@ static int uvc_v4l2_get_format(struct uvc_streaming > > *stream, > > > > fmt->fmt.pix.colorspace = format->colorspace; > > fmt->fmt.pix.priv = 0; > > > > +done: > > + mutex_unlock(&stream->mutex); > > > > return 0; > > But not returned?! My bad. I'll fix it. Thanks. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html