]> xenbits.xensource.com Git - xen.git/commitdiff
x86/irq: address violations of MISRA C Rule 20.7
authorNicola Vetrini <nicola.vetrini@bugseng.com>
Thu, 27 Jun 2024 11:47:16 +0000 (13:47 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 27 Jun 2024 11:47:16 +0000 (13:47 +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>
Acked-by: Jan Beulich <jbeulich@suse.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
xen/include/xen/irq.h

index 580ae37e742855b74e297bf06e2a8ef9e4398d07..17211f3399b7c0370101129a566421a887284b30 100644 (file)
@@ -178,7 +178,7 @@ extern struct pirq *pirq_get_info(struct domain *d, int pirq);
 
 #define pirq_field(d, p, f, def) ({ \
     const struct pirq *__pi = pirq_info(d, p); \
-    __pi ? __pi->f : def; \
+    __pi ? __pi->f : (def); \
 })
 #define pirq_to_evtchn(d, pirq) pirq_field(d, pirq, evtchn, 0)
 #define pirq_masked(d, pirq) pirq_field(d, pirq, masked, 0)