From patchwork Mon Dec 11 10:30:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13486984 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 5416EC46CC5 for ; Mon, 11 Dec 2023 10:30:54 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.651595.1017317 (Exim 4.92) (envelope-from ) id 1rCdYb-0005Dx-F0; Mon, 11 Dec 2023 10:30:37 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 651595.1017317; Mon, 11 Dec 2023 10:30:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rCdYb-0005D4-9p; Mon, 11 Dec 2023 10:30:37 +0000 Received: by outflank-mailman (input) for mailman id 651595; Mon, 11 Dec 2023 10:30:35 +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 1rCdYZ-00059V-Ts for xen-devel@lists.xenproject.org; Mon, 11 Dec 2023 10:30:35 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 514714a9-9810-11ee-98e8-6d05b1d4d9a1; Mon, 11 Dec 2023 11:30:34 +0100 (CET) Received: from nico.bugseng.com (unknown [147.123.100.131]) by support.bugseng.com (Postfix) with ESMTPSA id 4478F4EE0741; Mon, 11 Dec 2023 11:30:33 +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: 514714a9-9810-11ee-98e8-6d05b1d4d9a1 From: Nicola Vetrini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Nicola Vetrini , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [XEN PATCH 1/7] xen/shutdown: address MISRA C:2012 Rule 2.1 Date: Mon, 11 Dec 2023 11:30:22 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Given that 'hwdom_shutdown' is a noreturn function, unreachable breaks can be eliminated to resolve violations of Rule 2.1. On the occasion, the type of its parameter is changed to uint8_t. No functional change. Signed-off-by: Nicola Vetrini Reviewed-by: Stefano Stabellini --- xen/common/shutdown.c | 11 ++--------- xen/include/xen/shutdown.h | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/xen/common/shutdown.c b/xen/common/shutdown.c index 37901a4f3391..290f90d70fe1 100644 --- a/xen/common/shutdown.c +++ b/xen/common/shutdown.c @@ -30,7 +30,7 @@ static void noreturn maybe_reboot(void) } } -void hwdom_shutdown(u8 reason) +void hwdom_shutdown(uint8_t reason) { switch ( reason ) { @@ -38,39 +38,32 @@ void hwdom_shutdown(u8 reason) printk("Hardware Dom%u halted: halting machine\n", hardware_domain->domain_id); machine_halt(); - break; /* not reached */ case SHUTDOWN_crash: debugger_trap_immediate(); printk("Hardware Dom%u crashed: ", hardware_domain->domain_id); kexec_crash(CRASHREASON_HWDOM); maybe_reboot(); - break; /* not reached */ case SHUTDOWN_reboot: printk("Hardware Dom%u shutdown: rebooting machine\n", hardware_domain->domain_id); machine_restart(0); - break; /* not reached */ case SHUTDOWN_watchdog: printk("Hardware Dom%u shutdown: watchdog rebooting machine\n", hardware_domain->domain_id); kexec_crash(CRASHREASON_WATCHDOG); machine_restart(0); - break; /* not reached */ case SHUTDOWN_soft_reset: printk("Hardware domain %d did unsupported soft reset, rebooting.\n", hardware_domain->domain_id); machine_restart(0); - break; /* not reached */ default: printk("Hardware Dom%u shutdown (unknown reason %u): ", hardware_domain->domain_id, reason); maybe_reboot(); - break; /* not reached */ } -} - +} diff --git a/xen/include/xen/shutdown.h b/xen/include/xen/shutdown.h index 668aed0be580..3537c30e0a1b 100644 --- a/xen/include/xen/shutdown.h +++ b/xen/include/xen/shutdown.h @@ -6,7 +6,7 @@ /* opt_noreboot: If true, machine will need manual reset on error. */ extern bool opt_noreboot; -void noreturn hwdom_shutdown(u8 reason); +void noreturn hwdom_shutdown(uint8_t reason); void noreturn machine_restart(unsigned int delay_millisecs); void noreturn machine_halt(void);