summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/mutex_32.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/include/asm/mutex_32.h')
-rw-r--r--arch/x86/include/asm/mutex_32.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/include/asm/mutex_32.h b/arch/x86/include/asm/mutex_32.h
index 85e6cda45a02..e9355a84fc67 100644
--- a/arch/x86/include/asm/mutex_32.h
+++ b/arch/x86/include/asm/mutex_32.h
@@ -101,7 +101,7 @@ static inline int __mutex_fastpath_trylock(atomic_t *count,
int (*fail_fn)(atomic_t *))
{
/* cmpxchg because it never induces a false contention state. */
- if (likely(atomic_cmpxchg(count, 1, 0) == 1))
+ if (likely(atomic_read(count) == 1 && atomic_cmpxchg(count, 1, 0) == 1))
return 1;
return 0;