diff mbox

xtensa: fix atomic_decrement_if_positive() return value

Message ID 3dde633646a3e76217744dbd9e151a4e913a2e88.1380721529.git.baruch@tkos.co.il
State Accepted, archived
Headers show

Commit Message

Baruch Siach Oct. 2, 2013, 1:45 p.m. UTC
atomic_decrement_if_positive() returns the old value of &mem, not the
(sometimes undefined) value of __tmp.

Fixes the uClibc nptl/tst-sem3 test.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 libc/sysdeps/linux/xtensa/bits/atomic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bernhard Reutner-Fischer Nov. 6, 2013, 9:29 p.m. UTC | #1
On Wed, Oct 02, 2013 at 04:45:54PM +0300, Baruch Siach wrote:
>atomic_decrement_if_positive() returns the old value of &mem, not the
>(sometimes undefined) value of __tmp.
>
>Fixes the uClibc nptl/tst-sem3 test.

Applied, thanks!
diff mbox

Patch

diff --git a/libc/sysdeps/linux/xtensa/bits/atomic.h b/libc/sysdeps/linux/xtensa/bits/atomic.h
index a31841a..b2be547 100644
--- a/libc/sysdeps/linux/xtensa/bits/atomic.h
+++ b/libc/sysdeps/linux/xtensa/bits/atomic.h
@@ -154,7 +154,7 @@  typedef uintmax_t uatomic_max_t;
       : "=&a" (__value), "=&a" (__tmp)                               \
       : "a" (mem)                                                    \
       : "memory" );                                                  \
-    __tmp;                                                           \
+    __value;                                                         \
   })