From patchwork Wed Apr 26 10:46:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Fancellu X-Patchwork-Id: 13224465 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1CADCC77B60 for ; Wed, 26 Apr 2023 10:46:48 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.526624.818504 (Exim 4.92) (envelope-from ) id 1prcfH-00009d-Gv; Wed, 26 Apr 2023 10:46:23 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 526624.818504; Wed, 26 Apr 2023 10:46:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1prcfH-00009W-EA; Wed, 26 Apr 2023 10:46:23 +0000 Received: by outflank-mailman (input) for mailman id 526624; Wed, 26 Apr 2023 10:46:22 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1prcfG-00009P-Bk for xen-devel@lists.xenproject.org; Wed, 26 Apr 2023 10:46:22 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 9453c809-e41f-11ed-b224-6b7b168915f2; Wed, 26 Apr 2023 12:46:20 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C0DEE4B3; Wed, 26 Apr 2023 03:47:03 -0700 (PDT) Received: from e125770.cambridge.arm.com (e125770.arm.com [10.1.199.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8CB0D3F5A1; Wed, 26 Apr 2023 03:46:18 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9453c809-e41f-11ed-b224-6b7b168915f2 From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: bertrand.marquis@arm.com, wei.chen@arm.com, Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH] xen/misra: xen-analysis.py: fix return error on PhaseExceptions Date: Wed, 26 Apr 2023 11:46:05 +0100 Message-Id: <20230426104605.3447049-1-luca.fancellu@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Currently the script return code is 0 even if an exception is found, because the return code is written only if the exception object has the errorcode member. Fix the issue returning the errorcode member in case it exists, otherwise use a generic value different from 0. Fixes: 02b26c02c7c4 ("xen/scripts: add cppcheck tool to the xen-analysis.py script") Signed-off-by: Luca Fancellu --- xen/scripts/xen-analysis.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xen/scripts/xen-analysis.py b/xen/scripts/xen-analysis.py index 8e50c27cd898..7185c5a06d2c 100755 --- a/xen/scripts/xen-analysis.py +++ b/xen/scripts/xen-analysis.py @@ -26,8 +26,7 @@ def main(argv): cppcheck_analysis.generate_cppcheck_report() except PhaseExceptions as e: print("ERROR: {}".format(e)) - if hasattr(e, "errorcode"): - ret_code = e.errorcode + ret_code = e.errorcode if hasattr(e, "errorcode") else 1 finally: if settings.step_clean_analysis: cppcheck_analysis.clean_analysis_artifacts()