Skip to contentSkip to conversation

Trivial: Add parentheses to parameters in macros

PATCH New Igor Stoppa 1 participant 2 messages Nov 22, 2017

lore
Share & tools
lore
#0 lore raw

cover Trivial: Add parentheses to parameters in macros

Some parameters are used in macros without being surrounded by parentheses.

Igor Stoppa (1):
Add paretheses to macro parameters. For trivial

 include/linux/kernel.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.9.3
#1 lore raw

PATCH 1/1 Add paretheses to macro parameters. For trivial

kernel.h: Some macros are not wrapping their parameters with parentheses.

Cc Tetsuo Handa <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Javi Merino <[email protected]>
---
 include/linux/kernel.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
include/linux/kernel.h +4 -4
index 4b484ab..4061f46 100644
@@ -112,7 +112,7 @@
 /* The `const' in roundup() prevents gcc-3.3 from calling __divdi3 */
 #define roundup(x, y) (					\
 {							\
-	const typeof(y) __y = y;			\
+	const typeof(y) __y = (y);			\
 	(((x) + (__y - 1)) / __y) * __y;		\
 }							\
 )
@@ -131,8 +131,8 @@
  */
 #define DIV_ROUND_CLOSEST(x, divisor)(			\
 {							\
-	typeof(x) __x = x;				\
-	typeof(divisor) __d = divisor;			\
+	typeof(x) __x = (x);				\
+	typeof(divisor) __d = (divisor);		\
 	(((typeof(x))-1) > 0 ||				\
 	 ((typeof(divisor))-1) > 0 ||			\
 	 (((__x) > 0) == ((__d) > 0))) ?		\
@@ -146,7 +146,7 @@
  */
 #define DIV_ROUND_CLOSEST_ULL(x, divisor)(		\
 {							\
-	typeof(divisor) __d = divisor;			\
+	typeof(divisor) __d = (divisor);		\
 	unsigned long long _tmp = (x) + (__d) / 2;	\
 	do_div(_tmp, __d);				\
 	_tmp;						\
Signature · 1 line
2.9.3