Hi Michael, Thank you for the patch. On Wednesday 28 May 2014 09:38:04 Michael Grzeschik wrote: > Sizeimage is an property comming from the device. It's not safe to > depend on its value for imagesize on S_FMT. Its better to use simple > width * height for compressed formats without bits per pixel. I don't think this is right. Harcoding the buffer size to one bit per pixel in average will either waste memory, or result in buffers too small for proper operation. The maximum buffer size is transmitted to the host by the gadget userspace application through the UVC video probe and commit control. Userspace thus knows the buffer size it needs, and should use that information when allocating the buffers. I would be fine with hardcoding a maximum value in the driver though. > Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx> > --- > drivers/usb/gadget/uvc_v4l2.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/gadget/uvc_v4l2.c b/drivers/usb/gadget/uvc_v4l2.c > index ad48e81..3223b90 100644 > --- a/drivers/usb/gadget/uvc_v4l2.c > +++ b/drivers/usb/gadget/uvc_v4l2.c > @@ -98,7 +98,9 @@ uvc_v4l2_set_format(struct uvc_video *video, struct > v4l2_format *fmt) } > > bpl = format->bpp * fmt->fmt.pix.width / 8; > - imagesize = bpl ? bpl * fmt->fmt.pix.height : fmt->fmt.pix.sizeimage; > + imagesize = bpl ? > + bpl * fmt->fmt.pix.height : > + fmt->fmt.pix.height * fmt->fmt.pix.width; > > video->fcc = format->fcc; > video->bpp = format->bpp; -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html