]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[media] soc_camera: fix VIDIOC_S_CROP ioctl
authorAnatolij Gustschin <agust@denx.de>
Wed, 28 Nov 2012 20:15:51 +0000 (17:15 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 4 Dec 2012 16:59:43 +0000 (14:59 -0200)
Sometimes VIDIOC_S_CROP ioctl doesn't work, soc-camera driver reports:
soc-camera-pdrv soc-camera-pdrv.0: S_CROP denied: getting current crop failed
The VIDIOC_G_CROP documentation states that the type field needs to be
set to the respective buffer type when querying, so the check in .g_crop()
of the subdevices returns -EINVAL if the type is not set properly. Here the
uninitialized local variable 'current_crop' is passed to the .g_crop() and
this leads to the observed error. Initialize the type field of the local
'current_crop' before get_crop call.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/platform/soc_camera/soc_camera.c

index 4e3735679f172fa3daf9620e3364a26987649da3..54da3a5f900ca70e3cfbbcb3f103831968888b20 100644 (file)
@@ -908,6 +908,8 @@ static int soc_camera_s_crop(struct file *file, void *fh,
        dev_dbg(icd->pdev, "S_CROP(%ux%u@%u:%u)\n",
                rect->width, rect->height, rect->left, rect->top);
 
+       current_crop.type = a->type;
+
        /* If get_crop fails, we'll let host and / or client drivers decide */
        ret = ici->ops->get_crop(icd, &current_crop);