[v1,2/9] v4l2: v4l2_camera: Remove repated index checks
diff mbox series

Message ID 20261201083805.496809-3-barnabas.pocze@ideasonboard.com
State New
Headers show
Series
  • v4l2: request-buffer split preparation
Related show

Commit Message

Barnabás Pőcze Dec. 1, 2026, 8:37 a.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 8c29b4d02c..3c9ec8f9c6 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);