From bc0818a6a94429f2abd070afaa489266e78bf86b Mon Sep 17 00:00:00 2001 From: Rick Chen Date: Mon, 12 Feb 2018 11:07:58 +0800 Subject: riscv: checkpatch: Fix Macro argument reuse It is CHECK reported by checkpatch.pl CHECK: Macro argument reuse 'PTE' - possible side-effects? Signed-off-by: Rick Chen Signed-off-by: Rick Chen --- arch/riscv/include/asm/string.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'arch/riscv/include/asm/string.h') diff --git a/arch/riscv/include/asm/string.h b/arch/riscv/include/asm/string.h index 038cdaea72..0fc3424a2f 100644 --- a/arch/riscv/include/asm/string.h +++ b/arch/riscv/include/asm/string.h @@ -26,8 +26,11 @@ #undef __HAVE_ARCH_MEMSET #ifdef CONFIG_MARCO_MEMSET -#define memset(p, v, n) \ - ({ \ +#define memset(_p, _v, _n) \ + (typeof(_p) (p) = (_p); \ + typeof(_v) (v) = (_v); \ + typeof(_n) (n) = (_n); \ + { \ if ((n) != 0) { \ if (__builtin_constant_p((v)) && (v) == 0) \ __memzero((p), (n)); \ @@ -37,7 +40,10 @@ (p); \ }) -#define memzero(p, n) ({ if ((n) != 0) __memzero((p), (n)); (p); }) +#define memzero(_p, _n) \ + (typeof(_p) (p) = (_p); \ + typeof(_n) (n) = (_n); \ + { if ((n) != 0) __memzero((p), (n)); (p); }) #endif #endif /* __ASM_RISCV_STRING_H */ -- cgit v1.2.1