From 4e0a8434d1acc842b528b2f163a40434d9263205 Mon Sep 17 00:00:00 2001 From: Jacek Anaszewski Date: Mon, 25 Nov 2013 06:58:10 -0300 Subject: [media] s5p-jpeg: Fix erroneous condition while validating bytesperline value The aim of the condition is ensuring that the bytesperline value set by the user space application is proper for the given format and adjusting it if isn't. As the depth value of the format description entry is expressed in bits then the bytesperline value needs to be divided, not multiplied, by that value to get the number of bytes required to store single line of image samples. Change-Id: Ied5ab2df3b4ab89d44178481a9b15c51e4d02085 Signed-off-by: Jacek Anaszewski Signed-off-by: Kyungmin Park Acked-by: Hans Verkuil Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index def4d94ccbd..d84ebdd0c15 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -670,7 +670,7 @@ static int vidioc_try_fmt(struct v4l2_format *f, struct s5p_jpeg_fmt *fmt, bpl = pix->width; /* planar */ if (fmt->colplanes == 1 && /* packed */ - (bpl << 3) * fmt->depth < pix->width) + (bpl << 3) / fmt->depth < pix->width) bpl = (pix->width * fmt->depth) >> 3; pix->bytesperline = bpl; -- cgit v1.2.3