[PATCH 8/9] usb: gadget/uvc: fix S_FMT always assume sizeimage for MJPEG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>

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.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 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux