CRIS: Fix bugs in return value of atomic_inc_return and atomic_dec_return.
Increment and decrement before assigning to return value.
This commit is contained in:
parent
b43890af88
commit
3c1d9303a9
1 changed files with 2 additions and 2 deletions
|
@ -91,7 +91,7 @@ static inline int atomic_inc_return(volatile atomic_t *v)
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int retval;
|
int retval;
|
||||||
cris_atomic_save(v, flags);
|
cris_atomic_save(v, flags);
|
||||||
retval = (v->counter)++;
|
retval = ++(v->counter);
|
||||||
cris_atomic_restore(v, flags);
|
cris_atomic_restore(v, flags);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ static inline int atomic_dec_return(volatile atomic_t *v)
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int retval;
|
int retval;
|
||||||
cris_atomic_save(v, flags);
|
cris_atomic_save(v, flags);
|
||||||
retval = (v->counter)--;
|
retval = --(v->counter);
|
||||||
cris_atomic_restore(v, flags);
|
cris_atomic_restore(v, flags);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue