[media] s5p-jpeg: Fix erroneous condition while validating bytesperline value
authorJacek Anaszewski <j.anaszewski@samsung.com>
Mon, 25 Nov 2013 09:58:10 +0000 (06:58 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Wed, 18 Dec 2013 08:12:32 +0000 (06:12 -0200)
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.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/platform/s5p-jpeg/jpeg-core.c

index eb06af1a40e9e938af9e7615b54a5763fa314800..c5b7d926dff84c25a72d82ab5bc72f870e63b37b 100644 (file)
@@ -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;