Commit d93cca2f authored by David McKay's avatar David McKay Committed by Arnd Bergmann

asm-generic: Fix 32 bit __generic_cmpxchg_local

Commit 656e9007 ("asm-generic: avoid __generic_cmpxchg_local
warnings") introduced a typo that means the code is incorrect for 32 bit
values. It will work fine for postive numbers, but will fail for
negative numbers on a system where longs are 64 bit.

Fixes: 656e9007 ("asm-generic: avoid __generic_cmpxchg_local warnings")
Signed-off-by: default avatarDavid McKay <david.mckay@codasip.com>
Signed-off-by: default avatarStuart Menefy <stuart.menefy@codasip.com>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent d6e81532
...@@ -34,7 +34,7 @@ static inline unsigned long __generic_cmpxchg_local(volatile void *ptr, ...@@ -34,7 +34,7 @@ static inline unsigned long __generic_cmpxchg_local(volatile void *ptr,
*(u16 *)ptr = (new & 0xffffu); *(u16 *)ptr = (new & 0xffffu);
break; break;
case 4: prev = *(u32 *)ptr; case 4: prev = *(u32 *)ptr;
if (prev == (old & 0xffffffffffu)) if (prev == (old & 0xffffffffu))
*(u32 *)ptr = (new & 0xffffffffu); *(u32 *)ptr = (new & 0xffffffffu);
break; break;
case 8: prev = *(u64 *)ptr; case 8: prev = *(u64 *)ptr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment