From: Michael Grzeschik <m.grzesc...@pengutronix.de>

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.

Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de>
---
 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 9fe2725..10e1c45 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;
-- 
1.8.2.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to