Mailing List Archive

[xen staging] x86/vlapic: tidy switch statement and address MISRA violation
commit 6af626c1da682655a6734a0d47899cb9b03d71ae
Author: Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Fri Apr 5 11:14:29 2024 +0200
Commit: Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 11 13:23:08 2024 +0100

x86/vlapic: tidy switch statement and address MISRA violation

Refactor the last clauses so that a violation of
MISRA C Rule 16.2 is resolved (A switch label shall only be used
when the most closely-enclosing compound statement is the body of
a switch statement). The switch clause ending with the
pseudo keyword "fallthrough" is an allowed exception to Rule 16.3.

No functional change.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
xen/arch/x86/hvm/vlapic.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index dcbcf4a1fe..05072a21bf 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -1033,11 +1033,11 @@ int guest_wrmsr_x2apic(struct vcpu *v, uint32_t msr, uint64_t val)

case APIC_EOI:
case APIC_ESR:
- if ( val )
- {
+ if ( !val )
+ break;
+ fallthrough;
default:
return X86EMUL_EXCEPTION;
- }
}

vlapic_reg_write(v, array_index_nospec(offset, PAGE_SIZE), val);
--
generated by git-patchbot for /home/xen/git/xen.git#staging