From patchwork Mon Dec 11 10:30:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13486989 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 7A7B9C4167B for ; Mon, 11 Dec 2023 10:30:57 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.651598.1017347 (Exim 4.92) (envelope-from ) id 1rCdYf-0005xz-BG; Mon, 11 Dec 2023 10:30:41 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 651598.1017347; Mon, 11 Dec 2023 10:30:41 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rCdYf-0005x1-3J; Mon, 11 Dec 2023 10:30:41 +0000 Received: by outflank-mailman (input) for mailman id 651598; Mon, 11 Dec 2023 10:30:39 +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 1rCdYd-0005Em-T4 for xen-devel@lists.xenproject.org; Mon, 11 Dec 2023 10:30:39 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 5238be18-9810-11ee-9b0f-b553b5be7939; Mon, 11 Dec 2023 11:30:36 +0100 (CET) Received: from nico.bugseng.com (unknown [147.123.100.131]) by support.bugseng.com (Postfix) with ESMTPSA id 801C84EE0743; Mon, 11 Dec 2023 11:30:35 +0100 (CET) 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: 5238be18-9810-11ee-9b0f-b553b5be7939 From: Nicola Vetrini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Nicola Vetrini , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [XEN PATCH 3/7] xen/arm: address MISRA C:2012 Rule 2.1 Date: Mon, 11 Dec 2023 11:30:24 +0100 Message-Id: <4c0d38f2b707afa9aed1853a99d286fa2424fb9d.1702283415.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 The "return 1;" statements at the end of some cases in the switch of function 'vgic_v3_its_mmio_write' in 'vcig-v3-its.c' cause the unreachability of the "return 1;" statement after the switch, thus violating MISRA C:2012 Rule 2.1: "A project shall not contain unreachable code". The same is true for the switch in 'arch_memory_op' from 'xen/arch/arm/mm.c'. Signed-off-by: Nicola Vetrini --- xen/arch/arm/mm.c | 2 +- xen/arch/arm/vgic-v3-its.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index eeb65ca6bb79..9be8e711f61e 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -277,7 +277,7 @@ long arch_memory_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg) /* XXX: memsharing not working yet */ case XENMEM_get_sharing_shared_pages: case XENMEM_get_sharing_freed_pages: - return 0; + break; default: return -ENOSYS; diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c index 05429030b539..b9195bbd0538 100644 --- a/xen/arch/arm/vgic-v3-its.c +++ b/xen/arch/arm/vgic-v3-its.c @@ -1255,7 +1255,7 @@ static int vgic_v3_its_mmio_write(struct vcpu *v, mmio_info_t *info, reg32 & GITS_CTLR_ENABLE); spin_unlock(&its->its_lock); spin_unlock(&its->vcmd_lock); - return 1; + break; } case VREG32(GITS_IIDR): @@ -1292,7 +1292,7 @@ static int vgic_v3_its_mmio_write(struct vcpu *v, mmio_info_t *info, its->creadr = 0; spin_unlock(&its->its_lock); - return 1; + break; case VREG64(GITS_CWRITER): if ( !vgic_reg64_check_access(info->dabt) ) goto bad_width; @@ -1308,7 +1308,7 @@ static int vgic_v3_its_mmio_write(struct vcpu *v, mmio_info_t *info, spin_unlock(&its->vcmd_lock); - return 1; + break; case VREG64(GITS_CREADR): goto write_ignore_64; @@ -1353,7 +1353,7 @@ static int vgic_v3_its_mmio_write(struct vcpu *v, mmio_info_t *info, its->baser_dev = reg; spin_unlock(&its->its_lock); - return 1; + break; case VREG64(GITS_BASER1): /* collection table */ if ( !vgic_reg64_check_access(info->dabt) ) goto bad_width; @@ -1384,7 +1384,7 @@ static int vgic_v3_its_mmio_write(struct vcpu *v, mmio_info_t *info, its->max_collections = 0; its->baser_coll = reg; spin_unlock(&its->its_lock); - return 1; + break; case VRANGE64(GITS_BASER2, GITS_BASER7): goto write_ignore_64;