[libcamera-devel] libcamera: v4l2_subdevice: Fix S_SELECTION ioctl argument

Message ID 20190218173038.13822-1-jacopo@jmondi.org
State Accepted
Headers show
Series
  • [libcamera-devel] libcamera: v4l2_subdevice: Fix S_SELECTION ioctl argument
Related show

Commit Message

Jacopo Mondi Feb. 18, 2019, 5:30 p.m. UTC
The SUBDEV_S_SELECTION argument needs to be a pointer. Fix it.

Fixes: 468176fa07d9 ("libcamera: Add V4L2Subdevice")
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/libcamera/v4l2_subdevice.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.20.1

Comments

Kieran Bingham Feb. 18, 2019, 5:34 p.m. UTC | #1
Hi Jacopo,

On 18/02/2019 17:30, Jacopo Mondi wrote:
> The SUBDEV_S_SELECTION argument needs to be a pointer. Fix it.

Ah yes, that might cause difficulties :-)

> 
> Fixes: 468176fa07d9 ("libcamera: Add V4L2Subdevice")
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  src/libcamera/v4l2_subdevice.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp
> index 17f715fe707a..b436f73cc75f 100644
> --- a/src/libcamera/v4l2_subdevice.cpp
> +++ b/src/libcamera/v4l2_subdevice.cpp
> @@ -250,7 +250,7 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,
>  	sel.r.width = rect->w;
>  	sel.r.height = rect->h;
> 
> -	int ret = ioctl(fd_, VIDIOC_SUBDEV_S_SELECTION, sel);
> +	int ret = ioctl(fd_, VIDIOC_SUBDEV_S_SELECTION, &sel);
>  	if (ret < 0) {
>  		ret = -errno;
>  		LOG(V4L2Subdev, Error)
> --
> 2.20.1
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
>

Patch

diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp
index 17f715fe707a..b436f73cc75f 100644
--- a/src/libcamera/v4l2_subdevice.cpp
+++ b/src/libcamera/v4l2_subdevice.cpp
@@ -250,7 +250,7 @@  int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,
 	sel.r.width = rect->w;
 	sel.r.height = rect->h;

-	int ret = ioctl(fd_, VIDIOC_SUBDEV_S_SELECTION, sel);
+	int ret = ioctl(fd_, VIDIOC_SUBDEV_S_SELECTION, &sel);
 	if (ret < 0) {
 		ret = -errno;
 		LOG(V4L2Subdev, Error)