While I was sifting through dead code findings, I stumbled on this function.
First, for __s390__ it always returned 0 for the 1st call, which doesn't seem
right. 2nd call & beyond would return the correct value though.
Then it duplicated the atomic_store multiple times, sometimes with a if,
sometimes without. Finally it used a capitalized variable name starting with k
which indicates a constant, and it is not.
So:
- rename the static global variable;
- change the atomic functions to their relaxed version;
- move the store to the end, and make sure we return val all the time.