Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 605a4103 authored by Anatolij Gustschin's avatar Anatolij Gustschin Committed by Mauro Carvalho Chehab
Browse files

[media] soc_camera: fix VIDIOC_S_CROP ioctl



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: default avatarAnatolij Gustschin <agust@denx.de>
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 16427faf
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);