OSDN Git Service

[media] vivid: fix typo in plane size checks
authorHans Verkuil <hans.verkuil@cisco.com>
Sat, 7 Mar 2015 15:19:36 +0000 (12:19 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Thu, 2 Apr 2015 23:29:19 +0000 (20:29 -0300)
The plane size check was hardcoded to plane 0 instead of using the plane
index.

This failed when using the NV61M format which has a larger plane size for
the second plane compared to the first plane.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/platform/vivid/vivid-vid-cap.c

index 550945a..49f79a0 100644 (file)
@@ -188,9 +188,9 @@ static int vid_cap_buf_prepare(struct vb2_buffer *vb)
                size = tpg_g_bytesperline(&dev->tpg, p) * dev->fmt_cap_rect.height +
                        dev->fmt_cap->data_offset[p];
 
-               if (vb2_plane_size(vb, 0) < size) {
+               if (vb2_plane_size(vb, p) < size) {
                        dprintk(dev, 1, "%s data will not fit into plane %u (%lu < %lu)\n",
-                                       __func__, p, vb2_plane_size(vb, 0), size);
+                                       __func__, p, vb2_plane_size(vb, p), size);
                        return -EINVAL;
                }