Skip to content

Commit d6b4548

Browse files
ubizjakPeter Zijlstra
authored andcommitted
locking/arch: Avoid variable shadowing in local_try_cmpxchg()
Several architectures define arch_try_local_cmpxchg macro using internal temporary variables named ___old, __old or _old. Remove temporary varible in local_try_cmpxchg to avoid variable shadowing. No functional change intended. Fixes: d994f2c ("locking/arch: Wire up local_try_cmpxchg()") Closes: https://lore.kernel.org/lkml/CAFGhKbyxtuk=LoW-E3yLXgcmR93m+Dfo5-u9oQA_YC5Fcy_t9g@mail.gmail.com/ Reported-by: Charlemagne Lasse <[email protected]> Signed-off-by: Uros Bizjak <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 28fd85a commit d6b4548

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

arch/loongarch/include/asm/local.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ static inline long local_cmpxchg(local_t *l, long old, long new)
6363

6464
static inline bool local_try_cmpxchg(local_t *l, long *old, long new)
6565
{
66-
typeof(l->a.counter) *__old = (typeof(l->a.counter) *) old;
67-
return try_cmpxchg_local(&l->a.counter, __old, new);
66+
return try_cmpxchg_local(&l->a.counter,
67+
(typeof(l->a.counter) *) old, new);
6868
}
6969

7070
#define local_xchg(l, n) (atomic_long_xchg((&(l)->a), (n)))

arch/mips/include/asm/local.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ static __inline__ long local_cmpxchg(local_t *l, long old, long new)
101101

102102
static __inline__ bool local_try_cmpxchg(local_t *l, long *old, long new)
103103
{
104-
typeof(l->a.counter) *__old = (typeof(l->a.counter) *) old;
105-
return try_cmpxchg_local(&l->a.counter, __old, new);
104+
return try_cmpxchg_local(&l->a.counter,
105+
(typeof(l->a.counter) *) old, new);
106106
}
107107

108108
#define local_xchg(l, n) (atomic_long_xchg((&(l)->a), (n)))

arch/x86/include/asm/local.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ static inline long local_cmpxchg(local_t *l, long old, long new)
127127

128128
static inline bool local_try_cmpxchg(local_t *l, long *old, long new)
129129
{
130-
typeof(l->a.counter) *__old = (typeof(l->a.counter) *) old;
131-
return try_cmpxchg_local(&l->a.counter, __old, new);
130+
return try_cmpxchg_local(&l->a.counter,
131+
(typeof(l->a.counter) *) old, new);
132132
}
133133

134134
/* Always has a lock prefix */

0 commit comments

Comments
 (0)