ARM: 7811/1: locks: use early clobber in arch_spin_trylock
authorWill Deacon <will.deacon@arm.com>
Mon, 12 Aug 2013 17:03:26 +0000 (18:03 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 13 Aug 2013 19:22:43 +0000 (20:22 +0100)
The res variable is written before we've finished with the input
operands (namely the lock address), so ensure that we mark it as `early
clobber' to avoid unintended register sharing.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/include/asm/spinlock.h

index f8b8965666e9b14842786742f48ccdef49000802..7ed43f68e04495479561d792c0e6dd8019213444 100644 (file)
@@ -107,7 +107,7 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock)
                "       subs    %1, %0, %0, ror #16\n"
                "       addeq   %0, %0, %4\n"
                "       strexeq %2, %0, [%3]"
-               : "=&r" (slock), "=&r" (contended), "=r" (res)
+               : "=&r" (slock), "=&r" (contended), "=&r" (res)
                : "r" (&lock->slock), "I" (1 << TICKET_SHIFT)
                : "cc");
        } while (res);