From nobody Wed May 15 10:55:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1682602017639871.5179251469862; Thu, 27 Apr 2023 06:26:57 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.527006.819132 (Exim 4.92) (envelope-from ) id 1ps1dY-0004BK-5m; Thu, 27 Apr 2023 13:26:16 +0000 Received: by outflank-mailman (output) from mailman id 527006.819132; Thu, 27 Apr 2023 13:26:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ps1dY-0004BD-2z; Thu, 27 Apr 2023 13:26:16 +0000 Received: by outflank-mailman (input) for mailman id 527006; Thu, 27 Apr 2023 13:26:14 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ps1dW-0004B7-Rv for xen-devel@lists.xenproject.org; Thu, 27 Apr 2023 13:26:14 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-flk1.inumbo.com (Halon) with ESMTP id 1278e750-e4ff-11ed-8611-37d641c3527e; Thu, 27 Apr 2023 15:26:10 +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 40FD62F4; Thu, 27 Apr 2023 06:26:53 -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 A48C43F587; Thu, 27 Apr 2023 06:26:08 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 1278e750-e4ff-11ed-8611-37d641c3527e From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: bertrand.marquis@arm.com, wei.chen@arm.com Subject: [PATCH v2] xen/misra: xen-analysis.py: fix return error on PhaseExceptions Date: Thu, 27 Apr 2023 14:25:59 +0100 Message-Id: <20230427132559.14712-1-luca.fancellu@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1682602020503100001 Content-Type: text/plain; charset="utf-8" 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 Change-Id: I1b76b8fa4668bef49da3282339fca3052e3379cd Reviewed-by: Andrew Cooper --- Changes from v1: - use getattr() (Andrew) --- 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..5e8f2910cd72 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 =3D e.errorcode + ret_code =3D getattr(e, "errorcode", 1) finally: if settings.step_clean_analysis: cppcheck_analysis.clean_analysis_artifacts() --=20 2.34.1