From patchwork Fri Mar 6 15:59:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2998 Return-Path: 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 71745628C8 for ; Fri, 6 Mar 2020 17:00:26 +0100 (CET) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0E083312 for ; Fri, 6 Mar 2020 17:00:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1583510426; bh=7PF0FfPppnfJyEzZJKQHWs0q6qi4YRMie18Dc/wYhjk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dyAjYxHbFqjPnFHkHzktaR4LIA7tTy8UICJ0xyHvWykbiQudGThQa9dQMQqAZYGgT RH3Xos9H0u6cX7EFf1VNAu/piacBzdaxM6fCACuqXuieNq3E6qY6A3N92i2zUfXKZt SoQ7v5M6fBWpUXrxCF5sC8NlbudSA2U/7DDT+OYo= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 6 Mar 2020 17:59:56 +0200 Message-Id: <20200306160002.30549-27-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200306160002.30549-1-laurent.pinchart@ideasonboard.com> References: <20200306160002.30549-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 26/32] libcamera: control_serializer: Use explicit ControlTypeNone case 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-List-Received-Date: Fri, 06 Mar 2020 16:00:28 -0000 Replace the default case with an explicit ControlTypeNone case in ControlSerializer::load() to catch omissions when adding new control types. A return statement needs to be added to the end of the function to avoid gcc incorrectly reporting that some exit paths don't contain a return statement. The compiler will still warn that not all cases are handled when adding a new control type. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- - Add a return statement at the end of the function --- src/libcamera/control_serializer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp index 6c676811ebf3..edf3e5cab09f 100644 --- a/src/libcamera/control_serializer.cpp +++ b/src/libcamera/control_serializer.cpp @@ -361,9 +361,11 @@ ControlValue ControlSerializer::load(ControlType type, return ControlValue(value); } - default: + case ControlTypeNone: return ControlValue(); } + + return ControlValue(); } template<>