[RFC,v1,09/54] v4l2: v4l2_camera: Remove repated index checks
diff mbox series

Message ID 20260629163017.863145-10-barnabas.pocze@ideasonboard.com
State New
Headers show
Series
  • libcamera: Split requests and buffers
Related show

Commit Message

Barnabás Pőcze June 29, 2026, 4:29 p.m. UTC
Check only once if the buffer index is valid.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
---
 src/v4l2/v4l2_camera_proxy.cpp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
index 03cd4810cc..b4f06c1c51 100644
--- a/src/v4l2/v4l2_camera_proxy.cpp
+++ b/src/v4l2/v4l2_camera_proxy.cpp
@@ -582,8 +582,7 @@  int V4L2CameraProxy::vidioc_querybuf(V4L2CameraFile *file, struct v4l2_buffer *a
 	if (arg->index >= bufferCount_)
 		return -EINVAL;
 
-	if (!validateBufferType(arg->type) ||
-	    arg->index >= bufferCount_)
+	if (!validateBufferType(arg->type))
 		return -EINVAL;
 
 	updateBuffers();
@@ -641,8 +640,7 @@  int V4L2CameraProxy::vidioc_qbuf(V4L2CameraFile *file, struct v4l2_buffer *arg)
 		return -EBUSY;
 
 	if (!validateBufferType(arg->type) ||
-	    !validateMemoryType(arg->memory) ||
-	    arg->index >= bufferCount_)
+	    !validateMemoryType(arg->memory))
 		return -EINVAL;
 
 	int ret = vcam_->qbuf(arg->index);