浏览代码

Fix mutex_trylock() copy-and-paste bug (x86, x86-64, generic mutex-dec.h)

Noticed by Arjan originally on x86-64, then Ingo on x86, and finally me
grepping for it in the generic version.

Bad parenthesis nesting.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Linus Torvalds 19 年之前
父节点
当前提交
4cec873614
共有 3 个文件被更改,包括 3 次插入3 次删除
  1. 1 1
      include/asm-generic/mutex-dec.h
  2. 1 1
      include/asm-i386/mutex.h
  3. 1 1
      include/asm-x86_64/mutex.h

+ 1 - 1
include/asm-generic/mutex-dec.h

@@ -97,7 +97,7 @@ __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
 	 * the mutex state would be.
 	 * the mutex state would be.
 	 */
 	 */
 #ifdef __HAVE_ARCH_CMPXCHG
 #ifdef __HAVE_ARCH_CMPXCHG
-	if (likely(atomic_cmpxchg(count, 1, 0)) == 1) {
+	if (likely(atomic_cmpxchg(count, 1, 0) == 1)) {
 		smp_mb();
 		smp_mb();
 		return 1;
 		return 1;
 	}
 	}

+ 1 - 1
include/asm-i386/mutex.h

@@ -125,7 +125,7 @@ __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
 	 * the mutex state would be.
 	 * the mutex state would be.
 	 */
 	 */
 #ifdef __HAVE_ARCH_CMPXCHG
 #ifdef __HAVE_ARCH_CMPXCHG
-	if (likely(atomic_cmpxchg(count, 1, 0)) == 1)
+	if (likely(atomic_cmpxchg(count, 1, 0) == 1))
 		return 1;
 		return 1;
 	return 0;
 	return 0;
 #else
 #else

+ 1 - 1
include/asm-x86_64/mutex.h

@@ -104,7 +104,7 @@ do {									\
 static inline int
 static inline int
 __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
 __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
 {
 {
-	if (likely(atomic_cmpxchg(count, 1, 0)) == 1)
+	if (likely(atomic_cmpxchg(count, 1, 0) == 1))
 		return 1;
 		return 1;
 	else
 	else
 		return 0;
 		return 0;