[libcamera-devel] libcamera: v4l2_device: Remove unused set of ret
diff mbox series

Message ID 20201028012114.3848208-1-niklas.soderlund@ragnatech.se
State Accepted
Commit bfd588d1d8332453b5f7afc6749fc6f3bf00c0bd
Headers show
Series
  • [libcamera-devel] libcamera: v4l2_device: Remove unused set of ret
Related show

Commit Message

Niklas Söderlund Oct. 28, 2020, 1:21 a.m. UTC
The last assignment of the ret variable in getControls() is not consumed
so it's unnecessary to set it. This likely originates from a similar
code flow in setControls() where the ret variable is later consumed.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
---
 src/libcamera/v4l2_device.cpp | 1 -
 1 file changed, 1 deletion(-)

Comments

Laurent Pinchart Oct. 28, 2020, 1:31 a.m. UTC | #1
Hi Niklas,

Thank you for the patch.

On Wed, Oct 28, 2020 at 02:21:14AM +0100, Niklas Söderlund wrote:
> The last assignment of the ret variable in getControls() is not consumed
> so it's unnecessary to set it. This likely originates from a similar
> code flow in setControls() where the ret variable is later consumed.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/libcamera/v4l2_device.cpp | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
> index 31d4dad0ee47b734..f747ba790886cfe0 100644
> --- a/src/libcamera/v4l2_device.cpp
> +++ b/src/libcamera/v4l2_device.cpp
> @@ -243,7 +243,6 @@ ControlList V4L2Device::getControls(const std::vector<uint32_t> &ids)
>  		LOG(V4L2, Error) << "Unable to read control " << errorIdx
>  				 << ": " << strerror(-ret);
>  		count = errorIdx - 1;
> -		ret = errorIdx;
>  	}
>  
>  	updateControls(&ctrls, v4l2Ctrls, count);
Kieran Bingham Oct. 28, 2020, 10:32 a.m. UTC | #2
On 28/10/2020 01:21, Niklas Söderlund wrote:
> The last assignment of the ret variable in getControls() is not consumed
> so it's unnecessary to set it. This likely originates from a similar
> code flow in setControls() where the ret variable is later consumed.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

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

> ---
>  src/libcamera/v4l2_device.cpp | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
> index 31d4dad0ee47b734..f747ba790886cfe0 100644
> --- a/src/libcamera/v4l2_device.cpp
> +++ b/src/libcamera/v4l2_device.cpp
> @@ -243,7 +243,6 @@ ControlList V4L2Device::getControls(const std::vector<uint32_t> &ids)
>  		LOG(V4L2, Error) << "Unable to read control " << errorIdx
>  				 << ": " << strerror(-ret);
>  		count = errorIdx - 1;
> -		ret = errorIdx;
>  	}
>  
>  	updateControls(&ctrls, v4l2Ctrls, count);
>

Patch
diff mbox series

diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
index 31d4dad0ee47b734..f747ba790886cfe0 100644
--- a/src/libcamera/v4l2_device.cpp
+++ b/src/libcamera/v4l2_device.cpp
@@ -243,7 +243,6 @@  ControlList V4L2Device::getControls(const std::vector<uint32_t> &ids)
 		LOG(V4L2, Error) << "Unable to read control " << errorIdx
 				 << ": " << strerror(-ret);
 		count = errorIdx - 1;
-		ret = errorIdx;
 	}
 
 	updateControls(&ctrls, v4l2Ctrls, count);