MISRA Rule 16.4: Every switch statement shall have a default label.
The default clause must contain either a statement or a comment
prior to its terminating break statement.

However, there is a documented deviation for this rule in Xen:
'docs/misra/deviations.rst':
* - R16.4
  - A switch statement with a single clause and no default label
    may replace an equivalent if statement to improve readability.
  - Tagged as `deliberate` for ECLAIR.

This change removes empty default cases in single-clause switches
to avoid violations of the rule where the `default` clause lacks
a suitable comment or statement.

Signed-off-by: Dmytro Prokopchuk <dmytro_prokopch...@epam.com>
---
Test CI pipeline:
https://gitlab.com/xen-project/people/dimaprkp4k/xen/-/pipelines/1965255558
---
 xen/arch/arm/cpuerrata.c | 2 --
 xen/arch/arm/gic.c       | 2 --
 xen/arch/arm/mmu/p2m.c   | 2 --
 xen/arch/arm/time.c      | 2 --
 xen/common/kexec.c       | 2 --
 5 files changed, 10 deletions(-)

diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
index 17cf134f1b..4e84bc66fc 100644
--- a/xen/arch/arm/cpuerrata.c
+++ b/xen/arch/arm/cpuerrata.c
@@ -734,8 +734,6 @@ static int cpu_errata_callback(struct notifier_block *nfb,
         ASSERT(system_state != SYS_STATE_boot);
         rc = enable_nonboot_cpu_caps(arm_errata);
         break;
-    default:
-        break;
     }
 
     return notifier_from_errno(rc);
diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index e80fe0ca24..4f06ab9f0f 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -435,8 +435,6 @@ static int cpu_gic_callback(struct notifier_block *nfb,
         /* This is reverting the work done in init_maintenance_interrupt */
         release_irq(gic_hw_ops->info->maintenance_irq, NULL);
         break;
-    default:
-        break;
     }
 
     return NOTIFY_DONE;
diff --git a/xen/arch/arm/mmu/p2m.c b/xen/arch/arm/mmu/p2m.c
index 51abf3504f..f53b93847a 100644
--- a/xen/arch/arm/mmu/p2m.c
+++ b/xen/arch/arm/mmu/p2m.c
@@ -1827,8 +1827,6 @@ static int cpu_virt_paging_callback(struct notifier_block 
*nfb,
         ASSERT(system_state != SYS_STATE_boot);
         setup_virt_paging_one(NULL);
         break;
-    default:
-        break;
     }
 
     return NOTIFY_DONE;
diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
index e74d30d258..0ccfd3b12d 100644
--- a/xen/arch/arm/time.c
+++ b/xen/arch/arm/time.c
@@ -381,8 +381,6 @@ static int cpu_time_callback(struct notifier_block *nfb,
     case CPU_DYING:
         deinit_timer_interrupt();
         break;
-    default:
-        break;
     }
 
     return NOTIFY_DONE;
diff --git a/xen/common/kexec.c b/xen/common/kexec.c
index 84fe8c3597..bb669da833 100644
--- a/xen/common/kexec.c
+++ b/xen/common/kexec.c
@@ -548,8 +548,6 @@ static int cf_check cpu_callback(
          * fail the CPU_UP_PREPARE */
         kexec_init_cpu_notes(cpu);
         break;
-    default:
-        break;
     }
     return NOTIFY_DONE;
 }
-- 
2.43.0

Reply via email to