From: Jesper Nilsson Date: Mon, 21 Jan 2008 16:01:31 +0000 (+0100) Subject: CRIS: Fix bugs in return value of atomic_inc_return and atomic_dec_return. X-Git-Tag: v2.6.25-rc1~40^2~75 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c1d9303a9676fd4f9062f2347f1a6241eb6314b;p=linux-2.6 CRIS: Fix bugs in return value of atomic_inc_return and atomic_dec_return. Increment and decrement before assigning to return value. --- diff --git a/include/asm-cris/atomic.h b/include/asm-cris/atomic.h index 2949a94587..5fc8776877 100644 --- a/include/asm-cris/atomic.h +++ b/include/asm-cris/atomic.h @@ -91,7 +91,7 @@ static inline int atomic_inc_return(volatile atomic_t *v) unsigned long flags; int retval; cris_atomic_save(v, flags); - retval = (v->counter)++; + retval = ++(v->counter); cris_atomic_restore(v, flags); return retval; } @@ -101,7 +101,7 @@ static inline int atomic_dec_return(volatile atomic_t *v) unsigned long flags; int retval; cris_atomic_save(v, flags); - retval = (v->counter)--; + retval = --(v->counter); cris_atomic_restore(v, flags); return retval; }