From patchwork Wed Jul 20 08:15:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 16698 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 C5BE9BD1F1 for ; Wed, 20 Jul 2022 08:15:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F07A763313; Wed, 20 Jul 2022 10:15:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1658304945; bh=s2VY5y0Lp8mjA4vzMVkyxNv/+lAUOnBtupHdG9moegc=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=AxhCDfQF8QwUNFp4RCBHRpH0h3OpQvQlVAn35rPmICmU2b70QjNhmbJ2g2aDuqhu1 G4UDc2RL/ME9BM6MqPGkyod0BZgyVhJBcNd1+JFnZq8sP+27UDLxVD85bWrZ1oqXJs S1CShXpR5yCinmsczB/0poWQVt6oxgsYbnk15bYzSICDdlGNwh6eslNA2QmoNXVBBF rjJNCxJPhXWca4W7nBvytGhlgRVbTLBbWY+Pj2TyCNOuDoTNVAURKXt2J90SxH8EqJ InLqZgydswbKbdxohi3C9tFxB6Gmo2DBO6BtUYQoWYQ+vDbdeDs9SkmqNVJAMGgJIR TnJ6hm1IKK5mg== Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9D82260488 for ; Wed, 20 Jul 2022 10:15:43 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="DJk2+n1G"; dkim-atps=neutral Received: by mail-wm1-x32f.google.com with SMTP id h14-20020a1ccc0e000000b0039eff745c53so762076wmb.5 for ; Wed, 20 Jul 2022 01:15:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Frt4dA9IQ4++88nxAX3d5SWe2d3G3n6SLoaXZ+zXUhk=; b=DJk2+n1G511+L0PFoP3MD23WkhcDRDinBO6Cv1tjEzFeaTEuzj/rlib+yy7wZIcByT oiemNSr+UO4b+chyC+BR+n6WpjYSvef753E9ODu3W9HdINJvzGgr5yH2KWQhnJPUyeZH Peak1a2hE1zHkZR92aeCMINGUKpBtUXq1uC61em/PjrDfjDEKEtykysJsCNMljzqKDNM zmyRDFnlvWPGColprHTPkMJZn75py8ZBnKAk7ISBz97aUmvGhB9+1ttL5dMkJWEtSco5 lpnbRFDkDNh1dy1aeE6aNQhKgk8FyLW8TMV6FG+dg+zCFoE2LzT3BB2+R56nKVNGU+KZ SfyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Frt4dA9IQ4++88nxAX3d5SWe2d3G3n6SLoaXZ+zXUhk=; b=xpW5337mF3ZS2wLSyXdY1Kr1agSWLrkZ+4KzIp5DcOCQ7qstZAVXoJIjRPXqMu2XKJ sH+sOCEchoM2eCQITynTpOZEuIapbDgdF7zzT/jBwrHRZ+F4zAUFGgn0t5xHMJczCZ06 3hQ6g6q+UMRPMA9Xo7pxyHYANePeSUUQZsM1JdKthpf9/9p93hFP0ElrpCuIbUfK4o/N LgUKZG6OzMAJcZ84g3tnj6i9AwugufUrDO5izWYECE4spOiRMdowbu5JcQIChzHnvTBq 4XqIGjX1zv2P9pVb3b5wOTm64RzLqWIwBlvwyMXuWkqmrSTMQvvxMCA0pFdIZzBcwkVy TWlQ== X-Gm-Message-State: AJIora+QvzNg+4/OPYCBVnWGWZrDCMIKFIWoqoadxIplj9YI3Hh9T4OZ CgZ57myTcvtjf+gX/UzuaIMbgCtj8928aw== X-Google-Smtp-Source: AGRyM1tr7bfoxHIXG2ZI8VITvHC3GI/uIdAIieqqSwxa2gtmeS/9pe11XpPienzRmPurneQBT77SHg== X-Received: by 2002:a7b:c401:0:b0:3a2:ca58:85bc with SMTP id k1-20020a7bc401000000b003a2ca5885bcmr2756901wmi.156.1658304942806; Wed, 20 Jul 2022 01:15:42 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id bp7-20020a5d5a87000000b0021d80f53324sm15555705wrb.7.2022.07.20.01.15.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 01:15:42 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 20 Jul 2022 09:15:34 +0100 Message-Id: <20220720081534.26400-1-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2] libcamera: controls: Suppress error message from ControlList::get() 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: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Now that ControlList::get() returns a std::optional to handle missing controls, the error log message in the call to ControlList::find() is unnecessary and likely invalid. Fix this by avoding the call to ControlList::find() from ControlList::get() and replacing with a call to the underlying std::unordered_map::find(). Fixes: 1c4d48018505 ("libcamera: controls: Use std::optional to handle invalid control values") Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart Reviewed-by: Umang Jain --- include/libcamera/controls.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 192be78434dc..8362fce813fb 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -376,11 +376,12 @@ public: template std::optional get(const Control &ctrl) const { - const ControlValue *val = find(ctrl.id()); - if (!val) + const auto entry = controls_.find(ctrl.id()); + if (entry == controls_.end()) return std::nullopt; - return val->get(); + const ControlValue &val = entry->second; + return val.get(); } template