From nobody Mon Nov 25 00:46:52 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 1718617831348642.5424062945243; Mon, 17 Jun 2024 02:50:31 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.742061.1148758 (Exim 4.92) (envelope-from ) id 1sJ8zv-00076M-13; Mon, 17 Jun 2024 09:49:59 +0000 Received: by outflank-mailman (output) from mailman id 742061.1148758; Mon, 17 Jun 2024 09:49:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sJ8zu-00076F-Tj; Mon, 17 Jun 2024 09:49:58 +0000 Received: by outflank-mailman (input) for mailman id 742061; Mon, 17 Jun 2024 09:49:57 +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 1sJ8zt-000769-PJ for xen-devel@lists.xenproject.org; Mon, 17 Jun 2024 09:49:57 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f396bfb3-2c8e-11ef-b4bb-af5377834399; Mon, 17 Jun 2024 11:49:55 +0200 (CEST) Received: from truciolo.bugseng.com (unknown [37.163.161.70]) by support.bugseng.com (Postfix) with ESMTPSA id EB7404EE0738; Mon, 17 Jun 2024 11:49:52 +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: f396bfb3-2c8e-11ef-b4bb-af5377834399 From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Dario Faggioli , Juergen Gross Subject: [XEN PATCH] xen: add explicit comment to identify notifier patterns Date: Mon, 17 Jun 2024 11:49:46 +0200 Message-Id: <96a1b98d7831154c58d39b85071b9670de94aed0.1718617636.git.federico.serafini@bugseng.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1718617833328100001 Content-Type: text/plain; charset="utf-8" MISRA C Rule 16.4 states that every `switch' statement shall have a `default' label" and a statement or a comment prior to the terminating break statement. This patch addresses some violations of the rule related to the "notifier pattern": a frequently-used pattern whereby only a few values are handled by the switch statement and nothing should be done for others (nothing to do in the default case). No functional change. Signed-off-by: Federico Serafini --- xen/arch/arm/cpuerrata.c | 1 + xen/arch/arm/gic.c | 1 + xen/arch/arm/irq.c | 4 ++++ xen/arch/arm/mmu/p2m.c | 1 + xen/arch/arm/percpu.c | 1 + xen/arch/arm/smpboot.c | 1 + xen/arch/arm/time.c | 1 + xen/arch/arm/vgic-v3-its.c | 2 ++ xen/arch/x86/cpu/mcheck/mce.c | 4 ++++ xen/arch/x86/genapic/x2apic.c | 3 +++ xen/arch/x86/hvm/hvm.c | 1 + xen/arch/x86/nmi.c | 1 + xen/arch/x86/percpu.c | 3 +++ xen/arch/x86/psr.c | 3 +++ xen/arch/x86/smpboot.c | 3 +++ xen/common/rcupdate.c | 1 + xen/common/sched/core.c | 1 + xen/common/sched/cpupool.c | 1 + xen/common/spinlock.c | 1 + xen/common/tasklet.c | 1 + xen/common/timer.c | 1 + xen/drivers/cpufreq/cpufreq.c | 1 + xen/drivers/passthrough/x86/hvm.c | 3 +++ xen/drivers/passthrough/x86/iommu.c | 3 +++ 24 files changed, 43 insertions(+) diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c index 2b7101ea25..69c30aecd8 100644 --- a/xen/arch/arm/cpuerrata.c +++ b/xen/arch/arm/cpuerrata.c @@ -730,6 +730,7 @@ static int cpu_errata_callback(struct notifier_block *n= fb, rc =3D enable_nonboot_cpu_caps(arm_errata); break; default: + /* Notifier pattern. */ break; } =20 diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 3eaf670fd7..dc5408a456 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -463,6 +463,7 @@ static int cpu_gic_callback(struct notifier_block *nfb, release_irq(gic_hw_ops->info->maintenance_irq, NULL); break; default: + /* Notifier pattern. */ break; } =20 diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c index c60502444c..61ca6f5b87 100644 --- a/xen/arch/arm/irq.c +++ b/xen/arch/arm/irq.c @@ -127,6 +127,10 @@ static int cpu_callback(struct notifier_block *nfb, un= signed long action, printk(XENLOG_ERR "Unable to allocate local IRQ for CPU%u\n", cpu); break; + + default: + /* Notifier pattern. */ + break; } =20 return notifier_from_errno(rc); diff --git a/xen/arch/arm/mmu/p2m.c b/xen/arch/arm/mmu/p2m.c index 1725cca649..bf7c66155d 100644 --- a/xen/arch/arm/mmu/p2m.c +++ b/xen/arch/arm/mmu/p2m.c @@ -1839,6 +1839,7 @@ static int cpu_virt_paging_callback(struct notifier_b= lock *nfb, setup_virt_paging_one(NULL); break; default: + /* Notifier pattern. */ break; } =20 diff --git a/xen/arch/arm/percpu.c b/xen/arch/arm/percpu.c index 87fe960330..81f91f05bb 100644 --- a/xen/arch/arm/percpu.c +++ b/xen/arch/arm/percpu.c @@ -66,6 +66,7 @@ static int cpu_percpu_callback( free_percpu_area(cpu); break; default: + /* Notifier pattern. */ break; } =20 diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c index 04e363088d..3d481e59f9 100644 --- a/xen/arch/arm/smpboot.c +++ b/xen/arch/arm/smpboot.c @@ -591,6 +591,7 @@ static int cpu_smpboot_callback(struct notifier_block *= nfb, remove_cpu_sibling_map(cpu); break; default: + /* Notifier pattern. */ break; } =20 diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c index e74d30d258..27cbfae874 100644 --- a/xen/arch/arm/time.c +++ b/xen/arch/arm/time.c @@ -382,6 +382,7 @@ static int cpu_time_callback(struct notifier_block *nfb, deinit_timer_interrupt(); break; default: + /* Notifier pattern. */ break; } =20 diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c index 70b5aeb822..a33ff64ff2 100644 --- a/xen/arch/arm/vgic-v3-its.c +++ b/xen/arch/arm/vgic-v3-its.c @@ -1194,6 +1194,7 @@ static void sanitize_its_base_reg(uint64_t *reg) r |=3D GIC_BASER_InnerShareable << GITS_BASER_SHAREABILITY_SHIFT; break; default: + /* Notifier pattern. */ break; } =20 @@ -1206,6 +1207,7 @@ static void sanitize_its_base_reg(uint64_t *reg) r |=3D GIC_BASER_CACHE_RaWb << GITS_BASER_INNER_CACHEABILITY_SHIFT; break; default: + /* Notifier pattern. */ break; } =20 diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c index 32c1b2756b..222b174bbb 100644 --- a/xen/arch/x86/cpu/mcheck/mce.c +++ b/xen/arch/x86/cpu/mcheck/mce.c @@ -722,6 +722,10 @@ static int cf_check cpu_callback( if ( park_offline_cpus ) cpu_bank_free(cpu); break; + + default: + /* Notifier pattern. */ + break; } =20 return notifier_from_errno(rc); diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c index 371dd100c7..d271102f9f 100644 --- a/xen/arch/x86/genapic/x2apic.c +++ b/xen/arch/x86/genapic/x2apic.c @@ -238,6 +238,9 @@ static int cf_check update_clusterinfo( } FREE_CPUMASK_VAR(per_cpu(scratch_mask, cpu)); break; + default: + /* Notifier pattern. */ + break; } =20 return notifier_from_errno(err); diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 8334ab1711..00c360cf24 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -123,6 +123,7 @@ static int cf_check cpu_callback( alternative_vcall(hvm_funcs.cpu_dead, cpu); break; default: + /* Notifier pattern. */ break; } =20 diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c index 9793fa2316..105efa5a71 100644 --- a/xen/arch/x86/nmi.c +++ b/xen/arch/x86/nmi.c @@ -434,6 +434,7 @@ static int cf_check cpu_nmi_callback( kill_timer(&per_cpu(nmi_timer, cpu)); break; default: + /* Notifier pattern. */ break; } =20 diff --git a/xen/arch/x86/percpu.c b/xen/arch/x86/percpu.c index 3205eacea6..627b56b9f3 100644 --- a/xen/arch/x86/percpu.c +++ b/xen/arch/x86/percpu.c @@ -84,6 +84,9 @@ static int cf_check cpu_percpu_callback( if ( park_offline_cpus ) free_percpu_area(cpu); break; + default: + /* Notifier pattern. */ + break; } =20 return notifier_from_errno(rc); diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c index 0b9631ac44..e76b129e6c 100644 --- a/xen/arch/x86/psr.c +++ b/xen/arch/x86/psr.c @@ -1661,6 +1661,9 @@ static int cf_check cpu_callback( case CPU_DEAD: psr_cpu_fini(cpu); break; + default: + /* Notifier pattern. */ + break; } =20 return notifier_from_errno(rc); diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 8aa621533f..5b9b196d58 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -1134,6 +1134,9 @@ static int cf_check cpu_smpboot_callback( case CPU_REMOVE: cpu_smpboot_free(cpu, true); break; + default: + /* Notifier pattern. */ + break; } =20 return notifier_from_errno(rc); diff --git a/xen/common/rcupdate.c b/xen/common/rcupdate.c index 212a99acd8..0fe4097544 100644 --- a/xen/common/rcupdate.c +++ b/xen/common/rcupdate.c @@ -657,6 +657,7 @@ static int cf_check cpu_callback( rcu_offline_cpu(&this_cpu(rcu_data), &rcu_ctrlblk, rdp); break; default: + /* Notifier pattern. */ break; } =20 diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index d84b65f197..dffa1ef476 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -2907,6 +2907,7 @@ static int cf_check cpu_schedule_callback( cpu_schedule_down(cpu); break; default: + /* Notifier pattern. */ break; } =20 diff --git a/xen/common/sched/cpupool.c b/xen/common/sched/cpupool.c index ad8f608462..c7117f4243 100644 --- a/xen/common/sched/cpupool.c +++ b/xen/common/sched/cpupool.c @@ -1073,6 +1073,7 @@ static int cf_check cpu_callback( cpupool_cpu_remove_forced(cpu); break; default: + /* Notifier pattern. */ break; } =20 diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c index 28c6e9d3ac..bf082478db 100644 --- a/xen/common/spinlock.c +++ b/xen/common/spinlock.c @@ -55,6 +55,7 @@ static int cf_check cpu_lockdebug_callback(struct notifie= r_block *nfb, break; =20 default: + /* Notifier pattern. */ break; } =20 diff --git a/xen/common/tasklet.c b/xen/common/tasklet.c index 4c8d87a338..879b1f0d80 100644 --- a/xen/common/tasklet.c +++ b/xen/common/tasklet.c @@ -232,6 +232,7 @@ static int cf_check cpu_callback( migrate_tasklets_from_cpu(cpu, &per_cpu(softirq_tasklet_list, cpu)= ); break; default: + /* Notifier pattern. */ break; } =20 diff --git a/xen/common/timer.c b/xen/common/timer.c index a21798b76f..60e9a1493e 100644 --- a/xen/common/timer.c +++ b/xen/common/timer.c @@ -677,6 +677,7 @@ static int cf_check cpu_callback( break; =20 default: + /* Notifier pattern. */ break; } =20 diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c index 8659ad3aee..9584b55398 100644 --- a/xen/drivers/cpufreq/cpufreq.c +++ b/xen/drivers/cpufreq/cpufreq.c @@ -682,6 +682,7 @@ static int cf_check cpu_callback( (void)cpufreq_del_cpu(cpu); break; default: + /* Notifier pattern. */ break; } =20 diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x8= 6/hvm.c index d3627e4af7..e5b6be4794 100644 --- a/xen/drivers/passthrough/x86/hvm.c +++ b/xen/drivers/passthrough/x86/hvm.c @@ -1122,6 +1122,9 @@ static int cf_check cpu_callback( */ ASSERT(list_empty(&per_cpu(dpci_list, cpu))); break; + default: + /* Notifier pattern. */ + break; } =20 return NOTIFY_DONE; diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/= x86/iommu.c index cc0062b027..f0c84eeb85 100644 --- a/xen/drivers/passthrough/x86/iommu.c +++ b/xen/drivers/passthrough/x86/iommu.c @@ -749,6 +749,9 @@ static int cf_check cpu_callback( if ( !page_list_empty(list) ) tasklet_schedule(tasklet); break; + default: + /* Notifier pattern. */ + break; } =20 return NOTIFY_DONE; --=20 2.34.1