CRIS: Fix bugs in return value of atomic_inc_return and atomic_dec_return.
authorJesper Nilsson <jesper.nilsson@axis.com>
Mon, 21 Jan 2008 16:01:31 +0000 (17:01 +0100)
committerJesper Nilsson <jesper.nilsson@axis.com>
Fri, 8 Feb 2008 10:06:33 +0000 (11:06 +0100)
Increment and decrement before assigning to return value.

include/asm-cris/atomic.h

index 2949a94..5fc8776 100644 (file)
@@ -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;
 }