diff options
Diffstat (limited to 'include/asm-generic/mutex-xchg.h')
| -rw-r--r-- | include/asm-generic/mutex-xchg.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/asm-generic/mutex-xchg.h b/include/asm-generic/mutex-xchg.h index a6b4a7bd6ac9..3269ec4e195f 100644 --- a/include/asm-generic/mutex-xchg.h +++ b/include/asm-generic/mutex-xchg.h | |||
| @@ -91,8 +91,12 @@ __mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *)) | |||
| 91 | static inline int | 91 | static inline int |
| 92 | __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *)) | 92 | __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *)) |
| 93 | { | 93 | { |
| 94 | int prev = atomic_xchg_acquire(count, 0); | 94 | int prev; |
| 95 | 95 | ||
| 96 | if (atomic_read(count) != 1) | ||
| 97 | return 0; | ||
| 98 | |||
| 99 | prev = atomic_xchg_acquire(count, 0); | ||
| 96 | if (unlikely(prev < 0)) { | 100 | if (unlikely(prev < 0)) { |
| 97 | /* | 101 | /* |
| 98 | * The lock was marked contended so we must restore that | 102 | * The lock was marked contended so we must restore that |
