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>
---
xen/common/domctl.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index f2e0e36a17c3..cad0ff9d2ec0 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -293,6 +293,9 @@ 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 +305,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 )
--
2.34.1
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>
---
xen/common/domctl.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index f2e0e36a17c3..cad0ff9d2ec0 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -293,6 +293,9 @@ 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 +305,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 )
--
2.34.1