]> xenbits.xensource.com Git - xen.git/commitdiff
x86/cpu-policy: Adjust CPUID_MAX_SERIALISED_LEAVES to placate MISRA
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 10 Oct 2023 09:52:53 +0000 (10:52 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 31 Oct 2023 16:10:14 +0000 (16:10 +0000)
MISRA doesn't like !!CONST being used in place of a 1 (Rule 10.1).  Update the
expression to just be a plain 1, which still matches the description.

No functional change.

Reported-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/include/xen/lib/x86/cpu-policy.h

index bab3eecda6c1d6ef2311daf9ea375cdbf1a51a7c..d5e447e9dc06cc301c2833888c7ab11b74d2e38f 100644 (file)
@@ -100,13 +100,14 @@ const char *x86_cpuid_vendor_to_str(unsigned int vendor);
  * interaction with the toolstack.  (Sum of all leaves in each union, less the
  * entries in basic which sub-unions hang off of.)
  */
-#define CPUID_MAX_SERIALISED_LEAVES                     \
-    (CPUID_GUEST_NR_BASIC +                             \
-     CPUID_GUEST_NR_FEAT   - !!CPUID_GUEST_NR_FEAT +    \
-     CPUID_GUEST_NR_CACHE  - !!CPUID_GUEST_NR_CACHE +   \
-     CPUID_GUEST_NR_TOPO   - !!CPUID_GUEST_NR_TOPO +    \
-     CPUID_GUEST_NR_XSTATE - !!CPUID_GUEST_NR_XSTATE +  \
-     CPUID_GUEST_NR_EXTD + 2 /* hv_limit and hv2_limit */ )
+#define CPUID_MAX_SERIALISED_LEAVES             \
+    (CPUID_GUEST_NR_BASIC +                     \
+     CPUID_GUEST_NR_FEAT   - 1 +                \
+     CPUID_GUEST_NR_CACHE  - 1 +                \
+     CPUID_GUEST_NR_TOPO   - 1 +                \
+     CPUID_GUEST_NR_XSTATE - 1 +                \
+     CPUID_GUEST_NR_EXTD +                      \
+     2 /* hv_limit and hv2_limit */ )
 
 /* Maximum number of MSRs written when serialising a cpu_policy. */
 #define MSR_MAX_SERIALISED_ENTRIES 2