Mailing List Archive

[xen staging] xen/domctl: address violations of MISRA C Rule 16.2
commit eeab8c4619c26e4ba4055430a46d6180cc73b2be
Author: Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Fri Apr 5 11:14:33 2024 +0200
Commit: Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 11 13:23:08 2024 +0100

xen/domctl: address violations of MISRA C Rule 16.2

Refactor the first clauses so that a violation of
MISRA C Rule 16.2 is resolved (a switch label should be immediately
enclosed in the compound statement of the switch).
Note that the switch clause ending with the pseudo
keyword "fallthrough" is an allowed exception to Rule 16.3.

Convert fallthrough comments in other clauses to the pseudo-keyword
while at it.

No functional change.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---
xen/common/domctl.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 43b0b074c3..2c0331bb05 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -293,6 +293,10 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)

switch ( op->cmd )
{
+ case XEN_DOMCTL_createdomain:
+ d = NULL;
+ break;
+
case XEN_DOMCTL_assign_device:
case XEN_DOMCTL_deassign_device:
if ( op->domain == DOMID_IO )
@@ -302,16 +306,15 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
}
else if ( op->domain == DOMID_INVALID )
return -ESRCH;
- /* fall through */
+ fallthrough;
case XEN_DOMCTL_test_assign_device:
case XEN_DOMCTL_vm_event_op:
if ( op->domain == DOMID_INVALID )
{
- case XEN_DOMCTL_createdomain:
d = NULL;
break;
}
- /* fall through */
+ fallthrough;
default:
d = rcu_lock_domain_by_id(op->domain);
if ( !d )
--
generated by git-patchbot for /home/xen/git/xen.git#staging