All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: xen-devel@lists.xenproject.org
Cc: sstabellini@kernel.org, michal.orzel@amd.com,
	xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com,
	consulting@bugseng.com, jbeulich@suse.com,
	andrew.cooper3@citrix.com, roger.pau@citrix.com,
	Nicola Vetrini <nicola.vetrini@bugseng.com>, Wei Liu <wl@xen.org>,
	Paul Durrant <paul@xen.org>,
	George Dunlap <george.dunlap@citrix.com>
Subject: [RFC PATCH] x86/vlapic: address a violation of MISRA C:2012 Rule 16.2
Date: Wed, 25 Oct 2023 15:22:32 +0200	[thread overview]
Message-ID: <99114c15a4256e6a0f39bd6de232ee4b8ad9b587.1698239734.git.nicola.vetrini@bugseng.com> (raw)

The clauses of a switch should be enclosed directly by a switch
statement to make the code more easily understandable and less
prone to errors.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
---
This patch is mainly indended to probe how the community, especially the
maintainers, would receive such modifications to the code, and whether there
would be consensus on the rule's adoption. Anyone is welcome to
give feedback on this, especially on the x86 side, where this pattern
is used more frequently.
---
 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 c7ce82d0649a..318dd48577e2 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -1034,10 +1034,10 @@ int guest_wrmsr_x2apic(struct vcpu *v, uint32_t msr, uint64_t val)
     case APIC_EOI:
     case APIC_ESR:
         if ( val )
-        {
-    default:
             return X86EMUL_EXCEPTION;
-        }
+        break;
+    default:
+        return X86EMUL_EXCEPTION;
     }
 
     vlapic_reg_write(v, array_index_nospec(offset, PAGE_SIZE), val);
-- 
2.34.1


             reply	other threads:[~2023-10-25 13:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25 13:22 Nicola Vetrini [this message]
2023-10-25 13:44 ` [RFC PATCH] x86/vlapic: address a violation of MISRA C:2012 Rule 16.2 Jan Beulich
2023-10-25 14:30   ` Nicola Vetrini
2023-11-21 14:46 ` Nicola Vetrini
2023-11-21 15:36 ` Jan Beulich
2023-11-21 16:21   ` Nicola Vetrini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99114c15a4256e6a0f39bd6de232ee4b8ad9b587.1698239734.git.nicola.vetrini@bugseng.com \
    --to=nicola.vetrini@bugseng.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ayan.kumar.halder@amd.com \
    --cc=consulting@bugseng.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=michal.orzel@amd.com \
    --cc=paul@xen.org \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    --cc=xenia.ragiadakou@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.