]> xenbits.xensource.com Git - xen.git/commitdiff
xen/spinlock: address violations of MISRA C Rule 20.7
authorNicola Vetrini <nicola.vetrini@bugseng.com>
Thu, 25 Apr 2024 07:49:34 +0000 (09:49 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 25 Apr 2024 07:49:34 +0000 (09:49 +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>
xen/common/spinlock.c
xen/include/xen/spinlock.h

index 5aa9ba618859d0290dda39de657204b991019218..558ea7ac351839930618ba17f1f239c96509f28c 100644 (file)
@@ -269,7 +269,7 @@ void spin_debug_disable(void)
         profile->lock_cnt++;                                                 \
     }
 #define LOCK_PROFILE_VAR(var, val)    s_time_t var = (val)
-#define LOCK_PROFILE_BLOCK(var)       var = var ? : NOW()
+#define LOCK_PROFILE_BLOCK(var)       (var) = (var) ? : NOW()
 #define LOCK_PROFILE_BLKACC(tst, val)                                        \
     if ( tst )                                                               \
     {                                                                        \
index 18793c5e29cb1a0b2ba5be9a00c77dbd0be014b3..8825affb25ca1a1c07d568c1b808e07dd1c487ac 100644 (file)
@@ -141,7 +141,7 @@ struct lock_profile_qhead {
         }                                                                     \
         prof->name = #l;                                                      \
         prof->ptr.lockptr = &(s)->l;                                          \
-        prof->is_rlock = isr;                                                 \
+        prof->is_rlock = (isr);                                               \
         prof->next = (s)->profile_head.elem_q;                                \
         (s)->profile_head.elem_q = prof;                                      \
     } while( 0 )