From nobody Tue May 21 23:39:00 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1712216997434921.5533622135938; Thu, 4 Apr 2024 00:49:57 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.700704.1094241 (Exim 4.92) (envelope-from ) id 1rsHqu-00045C-9v; Thu, 04 Apr 2024 07:49:40 +0000 Received: by outflank-mailman (output) from mailman id 700704.1094241; Thu, 04 Apr 2024 07:49:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rsHqu-000455-5c; Thu, 04 Apr 2024 07:49:40 +0000 Received: by outflank-mailman (input) for mailman id 700704; Thu, 04 Apr 2024 07:49:39 +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 1rsHqt-00044q-DZ for xen-devel@lists.xenproject.org; Thu, 04 Apr 2024 07:49:39 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e2e9403e-f257-11ee-afe5-a90da7624cb6; Thu, 04 Apr 2024 09:49:38 +0200 (CEST) Received: from truciolo.homenet.telecomitalia.it (host-82-59-164-46.retail.telecomitalia.it [82.59.164.46]) by support.bugseng.com (Postfix) with ESMTPSA id B76EB4EE0742; Thu, 4 Apr 2024 09:49:37 +0200 (CEST) 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: e2e9403e-f257-11ee-afe5-a90da7624cb6 From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , George Dunlap , Dario Faggioli Subject: [XEN PATCH v2 1/2] xen/sched: address violations of MISRA C:2012 Rule 16.3 Date: Thu, 4 Apr 2024 09:49:28 +0200 Message-Id: <08c449728221c9c2b9e87f22eb9d0cffbf7ecf68.1712215939.git.federico.serafini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1712216998595100001 Content-Type: text/plain; charset="utf-8" Add break statement to address a violation of MISRA C:2012 Rule 16.3 ("An unconditional `break' statement shall terminate every switch-clause"). Replace deprecated comment /* FALLTHRU */ with pseudo-keyword fallthrough to meet the requirements to deviate the rule. No functional change. Signed-off-by: Federico Serafini Acked-by: George Dunlap Reviewed-by: Jan Beulich --- Changes in v2: - this patch is the result of merging together two different patches with t= he same title; - commit message has been improved to make clear that the comment is deprecated. --- xen/common/sched/core.c | 1 + xen/common/sched/credit2.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index 3e48da1cdd..0cb33831d2 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -2007,6 +2007,7 @@ ret_t do_sched_op(int cmd, XEN_GUEST_HANDLE_PARAM(voi= d) arg) =20 default: ret =3D -ENOSYS; + break; } =20 return ret; diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c index c76330d79d..0962b52415 100644 --- a/xen/common/sched/credit2.c +++ b/xen/common/sched/credit2.c @@ -3152,8 +3152,8 @@ static int cf_check csched2_sys_cntl( printk(XENLOG_INFO "Disabling context switch rate limiting\n"); prv->ratelimit_us =3D params->ratelimit_us; write_unlock_irqrestore(&prv->lock, flags); + fallthrough; =20 - /* FALLTHRU */ case XEN_SYSCTL_SCHEDOP_getinfo: params->ratelimit_us =3D prv->ratelimit_us; break; --=20 2.34.1 From nobody Tue May 21 23:39:00 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1712216998536498.35945243892456; Thu, 4 Apr 2024 00:49:58 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.700706.1094256 (Exim 4.92) (envelope-from ) id 1rsHqv-0004Nk-PO; Thu, 04 Apr 2024 07:49:41 +0000 Received: by outflank-mailman (output) from mailman id 700706.1094256; Thu, 04 Apr 2024 07:49: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 1rsHqv-0004M7-LR; Thu, 04 Apr 2024 07:49:41 +0000 Received: by outflank-mailman (input) for mailman id 700706; Thu, 04 Apr 2024 07:49:40 +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 1rsHqu-00044q-3E for xen-devel@lists.xenproject.org; Thu, 04 Apr 2024 07:49:40 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e3288060-f257-11ee-afe5-a90da7624cb6; Thu, 04 Apr 2024 09:49:38 +0200 (CEST) Received: from truciolo.homenet.telecomitalia.it (host-82-59-164-46.retail.telecomitalia.it [82.59.164.46]) by support.bugseng.com (Postfix) with ESMTPSA id 0723F4EE0744; Thu, 4 Apr 2024 09:49:38 +0200 (CEST) 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: e3288060-f257-11ee-afe5-a90da7624cb6 From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [XEN PATCH v2 2/2] vsprintf: address violations of MISRA C:2012 Rule 16.3 Date: Thu, 4 Apr 2024 09:49:29 +0200 Message-Id: <9705ea09d3dac2e569c075cd9bd7f594796b12c1.1712215939.git.federico.serafini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1712216999838100003 Content-Type: text/plain; charset="utf-8" MISRA C:2012 Rule 16.3 states: "An unconditional `break' statement shall terminate every switch-clause". In order to meet the requirements to deviate the rule: 1) refactor the for loop to make the switch-clause ending with a return statement (note that adding a break at the end of the switch-clause would result in a violation of Rule 2.1 "A project shall not contain unreachable code"); 2) add pseudo-keyword fallthrough. No functional change. Signed-off-by: Federico Serafini Reviewed-by: Jan Beulich --- Changes in v2: - improved commit message. --- xen/common/vsprintf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xen/common/vsprintf.c b/xen/common/vsprintf.c index c49631c0a4..612751c90f 100644 --- a/xen/common/vsprintf.c +++ b/xen/common/vsprintf.c @@ -377,7 +377,7 @@ static char *pointer(char *str, const char *end, const = char **fmt_ptr, str =3D number(str, end, hex_buffer[i], 16, 2, -1, ZEROPAD); =20 if ( ++i =3D=3D field_width ) - return str; + break; =20 if ( sep ) { @@ -386,6 +386,8 @@ static char *pointer(char *str, const char *end, const = char **fmt_ptr, ++str; } } + + return str; } =20 case 'p': /* PCI SBDF. */ @@ -619,6 +621,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, = va_list args) =20 case 'X': flags |=3D LARGE; + fallthrough; case 'x': base =3D 16; break; @@ -626,6 +629,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, = va_list args) case 'd': case 'i': flags |=3D SIGN; + fallthrough; case 'u': break; =20 --=20 2.34.1