提交 b04ec261 编写于 作者: H Hirokazu Takata 提交者: Linus Torvalds

[PATCH] m32r: __cmpxchg_u32 fix

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: NHayato Fujiwara <fujiwara@linux-m32r.org>
Signed-off-by: NHirokazu Takata <takata@linux-m32r.org>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 49d9c81a
...@@ -239,7 +239,7 @@ __cmpxchg_u32(volatile unsigned int *p, unsigned int old, unsigned int new) ...@@ -239,7 +239,7 @@ __cmpxchg_u32(volatile unsigned int *p, unsigned int old, unsigned int new)
" bra 2f; \n" " bra 2f; \n"
" .fillinsn \n" " .fillinsn \n"
"1:" "1:"
M32R_UNLOCK" %2, @%1; \n" M32R_UNLOCK" %0, @%1; \n"
" .fillinsn \n" " .fillinsn \n"
"2:" "2:"
: "=&r" (retval) : "=&r" (retval)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册