From patchwork Wed Apr 14 14:10:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 11930 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 4E09DBD224 for ; Wed, 14 Apr 2021 14:10:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 19C5968814; Wed, 14 Apr 2021 16:10:26 +0200 (CEST) Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AC94968803 for ; Wed, 14 Apr 2021 16:10:24 +0200 (CEST) X-Halon-ID: 231913a0-9d2b-11eb-a9ab-0050569116f7 Authorized-sender: niklas.soderlund@fsdn.se Received: from bismarck.berto.se (p54ac5521.dip0.t-ipconnect.de [84.172.85.33]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA id 231913a0-9d2b-11eb-a9ab-0050569116f7; Wed, 14 Apr 2021 16:10:23 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Wed, 14 Apr 2021 16:10:14 +0200 Message-Id: <20210414141014.523762-1-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] lc-compliance: simple_capture: Handle unsupported roles 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" It's valid for a camera to return a nullptr if the requested set of roles can not be satisfied. This is not correctly handled by lc-compliance which instead crashes, fix this. Signed-off-by: Niklas Söderlund Reviewed-by: Kieran Bingham Tested-by: Nícolas F. R. A. Prado --- src/lc-compliance/simple_capture.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lc-compliance/simple_capture.cpp b/src/lc-compliance/simple_capture.cpp index 811a6220009654be..64e862a08e3a8221 100644 --- a/src/lc-compliance/simple_capture.cpp +++ b/src/lc-compliance/simple_capture.cpp @@ -23,6 +23,9 @@ Results::Result SimpleCapture::configure(StreamRole role) { config_ = camera_->generateConfiguration({ role }); + if (!config_) + return { Results::Skip, "Role not supported by camera" }; + if (config_->validate() != CameraConfiguration::Valid) { config_.reset(); return { Results::Fail, "Configuration not valid" };