|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XEN PATCH v2 7/9] xen/xsm: address violation of MISRA C Rule 16.2
Refactor the switch 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).
Note that the switch clause ending with the pseudo
keyword "fallthrough" is an allowed exception to Rule 16.3.
Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
---
The second switch is not the best in terms of readability, so it may
be best to deviate this particular instance.
---
xen/include/xsm/dummy.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 88039fdd227c..84d3a8ed1c94 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -83,17 +83,17 @@ static always_inline int xsm_default_action(
return 0;
case XSM_TARGET:
if ( evaluate_nospec(src == target) )
- {
return 0;
+ fallthrough;
case XSM_XS_PRIV:
- if ( evaluate_nospec(is_xenstore_domain(src)) )
- return 0;
- }
- /* fall through */
+ if ( (action == XSM_XS_PRIV) &&
+ evaluate_nospec(is_xenstore_domain(src)) )
+ return 0;
+ fallthrough;
case XSM_DM_PRIV:
if ( target && evaluate_nospec(src->target == target) )
return 0;
- /* fall through */
+ fallthrough;
case XSM_PRIV:
if ( is_control_domain(src) )
return 0;
--
2.34.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |