Patchwork xtensa: fix atomic_decrement_if_positive() return value

login
register
mail settings
Submitter Baruch Siach
Date Oct. 2, 2013, 1:45 p.m.
Message ID <3dde633646a3e76217744dbd9e151a4e913a2e88.1380721529.git.baruch@tkos.co.il>
Download mbox | patch
Permalink /patch/279745/
State Accepted, archived
Headers show

Comments

Baruch Siach - Oct. 2, 2013, 1:45 p.m.
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(-)
aldot - Nov. 6, 2013, 9:29 p.m.
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!

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;                                                         \
   })