arm/atomic: fix MISRA C 2012 Rule 20.7 violation
authorXenia Ragiadakou <burzalodowa@gmail.com>
Fri, 29 Jul 2022 06:51:31 +0000 (08:51 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 29 Jul 2022 06:51:31 +0000 (08:51 +0200)
The macro parameter 'p' is used as an expression and needs to be enclosed in
parentheses.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/include/asm/atomic.h

index ac2798d095eb90d786f19a9a55c2afd8def81afe..1f60c28b1bdfd3d4052bef8f10fb089ff1f6b559 100644 (file)
@@ -123,15 +123,15 @@ static always_inline void write_atomic_size(volatile void *p,
 }
 
 #define read_atomic(p) ({                                               \
-    union { typeof(*p) val; char c[0]; } x_;                            \
-    read_atomic_size(p, x_.c, sizeof(*p));                              \
+    union { typeof(*(p)) val; char c[0]; } x_;                          \
+    read_atomic_size(p, x_.c, sizeof(*(p)));                            \
     x_.val;                                                             \
 })
 
 #define write_atomic(p, x)                                              \
     do {                                                                \
-        typeof(*p) x_ = (x);                                            \
-        write_atomic_size(p, &x_, sizeof(*p));                          \
+        typeof(*(p)) x_ = (x);                                          \
+        write_atomic_size(p, &x_, sizeof(*(p)));                        \
     } while ( false )
 
 #define add_sized(p, x) ({                                              \