]> xenbits.xensource.com Git - people/andrewcoop/xen.git/commitdiff
x86/mce: Move MC_NCLASSES into the enum mctelem_class
authorNicola Vetrini <nicola.vetrini@bugseng.com>
Fri, 6 Oct 2023 08:26:10 +0000 (10:26 +0200)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 31 Oct 2023 16:10:14 +0000 (16:10 +0000)
The definition of MC_NCLASSES contained a violation of MISRA C:2012
Rule 10.1, therefore by moving it as an enumeration constant resolves the
violation and makes it more resilient to possible additions to that enum.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/cpu/mcheck/mctelem.c
xen/arch/x86/cpu/mcheck/mctelem.h

index 329ac20faf966fb51a9b1e85adb48836b05c7580..77a4d1d5ff4858ca44b729c5799b0a1d8df4689b 100644 (file)
@@ -64,8 +64,6 @@ struct mctelem_ent {
 
 #define MC_NENT (MC_URGENT_NENT + MC_NONURGENT_NENT)
 
-#define        MC_NCLASSES             (MC_NONURGENT + 1)
-
 #define        COOKIE2MCTE(c)          ((struct mctelem_ent *)(c))
 #define        MCTE2COOKIE(tep)        ((mctelem_cookie_t)(tep))
 
index d4eba53ae0e59832153a0882a62ee976cab30d5d..21b251847bc0d6fe9671ca4b892e114a20f79981 100644 (file)
@@ -55,8 +55,9 @@
 typedef struct mctelem_cookie *mctelem_cookie_t;
 
 typedef enum mctelem_class {
-       MC_URGENT,
-       MC_NONURGENT
+    MC_URGENT,
+    MC_NONURGENT,
+    MC_NCLASSES
 } mctelem_class_t;
 
 extern void mctelem_init(unsigned int);