]> xenbits.xensource.com Git - xen.git/commitdiff
x86/vpmu: address violations of MISRA C Rule 20.7
authorNicola Vetrini <nicola.vetrini@bugseng.com>
Tue, 21 May 2024 13:59:50 +0000 (15:59 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 21 May 2024 13:59:50 +0000 (15:59 +0200)
MISRA C Rule 20.7 states: "Expressions resulting from the expansion
of macro parameters shall be enclosed in parentheses". Therefore, some
macro definitions should gain additional parentheses to ensure that all
current and future users will be safe with respect to expansions that
can possibly alter the semantics of the passed-in macro parameter.

No functional change.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/cpu/vpmu_amd.c

index db2fa420e14ab00ff2ff82fc8a9de9bbb726a523..97e6315bd9f7499fea51172f323eb21e2d29aa93 100644 (file)
@@ -25,8 +25,8 @@
 
 #define is_guest_mode(msr) ((msr) & (1ULL << MSR_F10H_EVNTSEL_GO_SHIFT))
 #define is_pmu_enabled(msr) ((msr) & (1ULL << MSR_F10H_EVNTSEL_EN_SHIFT))
-#define set_guest_mode(msr) (msr |= (1ULL << MSR_F10H_EVNTSEL_GO_SHIFT))
-#define is_overflowed(msr) (!((msr) & (1ULL << (MSR_F10H_COUNTER_LENGTH-1))))
+#define set_guest_mode(msr) ((msr) |= (1ULL << MSR_F10H_EVNTSEL_GO_SHIFT))
+#define is_overflowed(msr) (!((msr) & (1ULL << (MSR_F10H_COUNTER_LENGTH - 1))))
 
 static unsigned int __read_mostly num_counters;
 static const u32 __read_mostly *counters;