Skip to content

Commit 75cf979

Browse files
committed
parisc: Fix compiler warnings in debug_core.c
Fix this compiler warning: kernel/debug/debug_core.c: In function ‘kgdb_cpu_enter’: arch/parisc/include/asm/cmpxchg.h:48:3: warning: value computed is not used [-Wunused-value] 48 | ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))) arch/parisc/include/asm/atomic.h:78:30: note: in expansion of macro ‘xchg’ 78 | #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) | ^~~~ kernel/debug/debug_core.c:596:4: note: in expansion of macro ‘atomic_xchg’ 596 | atomic_xchg(&kgdb_active, cpu); | ^~~~~~~~~~~ Signed-off-by: Helge Deller <[email protected]>
1 parent 36257d5 commit 75cf979

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

arch/parisc/include/asm/cmpxchg.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,14 @@ __xchg(unsigned long x, __volatile__ void *ptr, int size)
4444
** if (((unsigned long)p & 0xf) == 0)
4545
** return __ldcw(p);
4646
*/
47-
#define xchg(ptr, x) \
48-
((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
47+
#define xchg(ptr, x) \
48+
({ \
49+
__typeof__(*(ptr)) __ret; \
50+
__typeof__(*(ptr)) _x_ = (x); \
51+
__ret = (__typeof__(*(ptr))) \
52+
__xchg((unsigned long)_x_, (ptr), sizeof(*(ptr))); \
53+
__ret; \
54+
})
4955

5056
/* bug catcher for when unsupported size is used - won't link */
5157
extern void __cmpxchg_called_with_bad_pointer(void);

0 commit comments

Comments
 (0)