From 282a576cecf3d1b3d256dc02ecfbdf184572a17e Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Thu, 26 Jun 2014 10:42:47 +1000 Subject: [PATCH] include/linux/kernel.h:744:28: note: in expansion of macro 'min' On Fri, Jun 20 2014, Fengguang Wu wrote: >>> include/linux/kernel.h:744:28: note: in expansion of macro 'min' > #define clamp(val, lo, hi) min(max(val, lo), hi) > ^ >>> drivers/net/ethernet/intel/i40e/i40e_debugfs.c:1901:11: note: in expans= ion of macro 'clamp' > bytes =3D clamp(bytes, (u16)1024, (u16)I40E_MAX_AQ_BUF_SIZE); > ^ Reported-by: Fengguang Wu Signed-off-by: Andrew Morton --- include/linux/kernel.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 44649e03bc70..149864b0833b 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -719,8 +719,8 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } (void) (&_max1 == &_max2); \ _max1 > _max2 ? _max1 : _max2; }) -#define min3(x, y, z) min(min(x, y), z) -#define max3(x, y, z) max(max(x, y), z) +#define min3(x, y, z) min((typeof(x))min(x, y), z) +#define max3(x, y, z) max((typeof(x))max(x, y), z) /** * min_not_zero - return the minimum that is _not_ zero, unless both are zero @@ -741,7 +741,7 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } * This macro does strict typechecking of min/max to make sure they are of the * same type as val. See the unnecessary pointer comparisons. */ -#define clamp(val, lo, hi) min(max(val, lo), hi) +#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi) /* * ..and if you can't take the strict -- 2.39.5