From mboxrd@z Thu Jan 1 00:00:00 1970 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 A217DC4332F for ; Tue, 12 Dec 2023 09:53:34 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.652885.1019006 (Exim 4.92) (envelope-from ) id 1rCzS8-00071I-PC; Tue, 12 Dec 2023 09:53:24 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 652885.1019006; Tue, 12 Dec 2023 09:53:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rCzS8-00071B-ME; Tue, 12 Dec 2023 09:53:24 +0000 Received: by outflank-mailman (input) for mailman id 652885; Tue, 12 Dec 2023 09:53:23 +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 1rCzS7-000715-OQ for xen-devel@lists.xenproject.org; Tue, 12 Dec 2023 09:53:23 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 48c0b07a-98d4-11ee-9b0f-b553b5be7939; Tue, 12 Dec 2023 10:53:21 +0100 (CET) Received: from support.bugseng.com (support.bugseng.com [162.55.131.47]) by support.bugseng.com (Postfix) with ESMTPA id 48B9C4EE0737; Tue, 12 Dec 2023 10:53:21 +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: 48c0b07a-98d4-11ee-9b0f-b553b5be7939 MIME-Version: 1.0 Date: Tue, 12 Dec 2023 10:53:21 +0100 From: Nicola Vetrini To: Jan Beulich Cc: consulting@bugseng.com, Andrew Cooper , George Dunlap , Julien Grall , Stefano Stabellini , Wei Liu , xen-devel@lists.xenproject.org Subject: Re: [XEN PATCH 1/7] xen/shutdown: address MISRA C:2012 Rule 2.1 In-Reply-To: References: Message-ID: <984227ed9db13d3e22d95081b03a127a@bugseng.com> X-Sender: nicola.vetrini@bugseng.com Organization: BUGSENG s.r.l. Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit On 2023-12-12 10:45, Jan Beulich wrote: > On 11.12.2023 11:30, Nicola Vetrini wrote: >> 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. > > I don't particularly mind that extra change, but it's entirely > unrelated > here. We do such when we touch lines (or maybe adjacent lines) anyway, > but here you had no need to touch either declaration or the header of > the definition. > Ok. I can make this a separate patch, since I'm already touching the function >> --- 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 */ > > Given the function's name, I don't view this removal (and the similar > one > further down) as acceptable. The function first needs renaming so that > from its name one can no longer (wrongly) infer that it may reboot or > else > return. > > Jan Something like "reboot_or_halt" would be okay? -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)