]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] m32r: __cmpxchg_u32 fix
authorHirokazu Takata <takata@linux-m32r.org>
Tue, 21 Feb 2006 02:28:15 +0000 (18:28 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 21 Feb 2006 04:00:12 +0000 (20:00 -0800)
This patch fixes a bug of include/asm-m32r/system.h:__cmpxchg_u32().

  static __inline__ unsigned long
  __cmpxchg_u32(volatile unsigned int *p, unsigned int old, unsigned int new);

In __cmpxchg_u32(), the "old" value must not be changed to the previous "*p"
value.  But the former code modifies the previous "*p" value.

A deadlock at _atomic_dec_and_lock sometimes happened due to this bug.

Signed-off-by: Hayato Fujiwara <fujiwara@linux-m32r.org>
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/asm-m32r/system.h

index 06c12a037cba557aab39a27eb302adbdf97d67f7..d6a2c613be68abff0d8a8d58de9bddbbf2800ac2 100644 (file)
@@ -239,7 +239,7 @@ __cmpxchg_u32(volatile unsigned int *p, unsigned int old, unsigned int new)
                "       bra     2f;             \n"
                 "       .fillinsn              \n"
                "1:"
-                       M32R_UNLOCK" %2, @%1;   \n"
+                       M32R_UNLOCK" %0, @%1;   \n"
                 "       .fillinsn              \n"
                "2:"
                        : "=&r" (retval)