From patchwork Tue Mar 24 12:32:14 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 26322 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 2D6E5C32DE for ; Tue, 24 Mar 2026 12:32:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5D51C62780; Tue, 24 Mar 2026 13:32:21 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="DL+pnxhW"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5EB156277D for ; Tue, 24 Mar 2026 13:32:18 +0100 (CET) Received: from pb-laptop.local (185.221.143.129.nat.pool.zt.hu [185.221.143.129]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 21CB5802 for ; Tue, 24 Mar 2026 13:31:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1774355461; bh=RCBlaBjt39RsguGf8HmWfh/3HjyqaZ270LM666tl/AY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DL+pnxhWxzuuST/QgNdd3GGKmeB3IsntfbKmQY2bWKP2N6X9hw9bONQRoh4janQO7 m5bDidVBQmMJcIn5lV9rcCzl2Qm/NhaHY9tPNsOJm8O3qSypm1heruW63FXATkEw1p xYCBcRt1pAgFegj7+vSfCjHnAJdFE2RmsveNqaFc= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v1 2/2] libcamera: v4l2_device: 0 is not a generic error index Date: Tue, 24 Mar 2026 13:32:14 +0100 Message-ID: <20260324123214.1762198-2-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260324123214.1762198-1-barnabas.pocze@ideasonboard.com> References: <20260324123214.1762198-1-barnabas.pocze@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" As per the kernel documentation: If the error is associated with a particular control, then ``error_idx`` is set to the index of that control. If the error is not related to a specific control, or the validation step failed , then ``error_idx`` is set to ``count``. Thus a value of 0 means that the first control could not be processed properly. So fix the conditions. Signed-off-by: Barnabás Pőcze Reviewed-by: Kieran Bingham --- src/libcamera/v4l2_device.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 53bd7865a..67bbaa037 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -260,7 +260,7 @@ ControlList V4L2Device::getControls(Span ids, const V4L2Request unsigned int errorIdx = v4l2ExtCtrls.error_idx; /* Generic validation error. */ - if (errorIdx == 0 || errorIdx >= v4l2Ctrls.size()) { + if (errorIdx >= v4l2Ctrls.size()) { LOG(V4L2, Error) << "Unable to read controls: " << strerror(-ret); return {}; @@ -405,7 +405,7 @@ int V4L2Device::setControls(ControlList *ctrls, const V4L2Request *request) unsigned int errorIdx = v4l2ExtCtrls.error_idx; /* Generic validation error. */ - if (errorIdx == 0 || errorIdx >= v4l2Ctrls.size()) { + if (errorIdx >= v4l2Ctrls.size()) { LOG(V4L2, Error) << "Unable to set controls: " << strerror(-ret); return -EINVAL;