]> Git Repo - linux.git/commitdiff
m68k: Fix asm register constraints for atomic ops
authorGeert Uytterhoeven <[email protected]>
Mon, 9 Aug 2021 11:29:03 +0000 (13:29 +0200)
committerGeert Uytterhoeven <[email protected]>
Mon, 23 Aug 2021 11:23:57 +0000 (13:23 +0200)
Depending on register assignment by the compiler:

    {standard input}:3084: Error: operands mismatch -- statement `andl %a1,%d1' ignored
    {standard input}:3145: Error: operands mismatch -- statement `orl %a1,%d1' ignored
    {standard input}:3195: Error: operands mismatch -- statement `eorl %a1,%d1' ignored

Indeed, the first operand must not be an address register.  However, it
can be an immediate value.  Fix this by adjusting the register
constraint from "g" (general purpose register) to "di" (data register or
immediate).

Fixes: e39d88ea3ce4a471 ("locking/atomic, arch/m68k: Implement atomic_fetch_{add,sub,and,or,xor}()")
Fixes: d839bae4269aea46 ("locking,arch,m68k: Fold atomic_ops")
Fixes: 1da177e4c3f41524 ("Linux-2.6.12-rc2")
Reported-by: kernel test robot <[email protected]>
Reported-by: Arnd Bergmann <[email protected]>
Reported-by: Alexander Viro <[email protected]>
Signed-off-by: Geert Uytterhoeven <[email protected]>
Tested-by: Arnd Bergmann <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
arch/m68k/include/asm/atomic.h

index 8637bf8a2f6520094420bc98fcc886671369c438..cfba83d230fdec37b34685e914be435e0eafec5d 100644 (file)
@@ -48,7 +48,7 @@ static inline int arch_atomic_##op##_return(int i, atomic_t *v)               \
                        "       casl %2,%1,%0\n"                        \
                        "       jne 1b"                                 \
                        : "+m" (*v), "=&d" (t), "=&d" (tmp)             \
-                       : "g" (i), "2" (arch_atomic_read(v)));          \
+                       : "di" (i), "2" (arch_atomic_read(v)));         \
        return t;                                                       \
 }
 
@@ -63,7 +63,7 @@ static inline int arch_atomic_fetch_##op(int i, atomic_t *v)          \
                        "       casl %2,%1,%0\n"                        \
                        "       jne 1b"                                 \
                        : "+m" (*v), "=&d" (t), "=&d" (tmp)             \
-                       : "g" (i), "2" (arch_atomic_read(v)));          \
+                       : "di" (i), "2" (arch_atomic_read(v)));         \
        return tmp;                                                     \
 }
 
This page took 0.0578 seconds and 4 git commands to generate.