diff options
author | Randy Dunlap <rdunlap@infradead.org> | 2020-10-20 07:33:28 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-02-19 01:40:22 +0100 |
commit | 356184fb6d67770d7788f316226be810a430937b (patch) | |
tree | 3f836ec155abc2f790f42c9d68e6e56199eb1a8e /arch | |
parent | sparc64: Use arch_validate_flags() to validate ADI flag (diff) | |
download | linux-356184fb6d67770d7788f316226be810a430937b.tar.xz linux-356184fb6d67770d7788f316226be810a430937b.zip |
sparc: make xchg() into a statement expression
Fix several of the same warning by using a GCC statement expression
(extension):
../arch/sparc/include/asm/cmpxchg_32.h:28:22: warning: value computed is not used [-Wunused-value]
28 | #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
Passes sparc32 allmodconfig with no xchg warnings.
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sparc/include/asm/cmpxchg_32.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/sparc/include/asm/cmpxchg_32.h b/arch/sparc/include/asm/cmpxchg_32.h index c73b5a3ab7b9..a53d744d4212 100644 --- a/arch/sparc/include/asm/cmpxchg_32.h +++ b/arch/sparc/include/asm/cmpxchg_32.h @@ -25,7 +25,7 @@ static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int return x; } -#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) +#define xchg(ptr,x) ({(__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)));}) /* Emulate cmpxchg() the same way we emulate atomics, * by hashing the object address and indexing into an array |