Re: [PATCH] m68k: cmpxchg: Fix return value for default case in __arch_xchg()

From: Geert Uytterhoeven
Date: Tue Jul 02 2024 - 03:21:49 EST


Hi Thorsten,

On Tue, Jul 2, 2024 at 5:42 AM Thorsten Blum <thorsten.blum@xxxxxxxxxx> wrote:
> The return value of __invalid_xchg_size() is assigned to tmp instead of
> the return variable x. Assign it to x instead.

Thanks for your patch!

> Fixes: 803f69144f0d ("Disintegrate asm/system.h for M68K")

That is not the right commit. The issue was introduced before:
Fixes: 2501cf768e4009a0 ("m68k: Fix xchg/cmpxchg to fail to link if
given an inappropriate pointer")

> Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxxx>

> --- a/arch/m68k/include/asm/cmpxchg.h
> +++ b/arch/m68k/include/asm/cmpxchg.h
> @@ -32,7 +32,7 @@ static inline unsigned long __arch_xchg(unsigned long x, volatile void * ptr, in
> x = tmp;
> break;
> default:
> - tmp = __invalid_xchg_size(x, ptr, size);
> + x = __invalid_xchg_size(x, ptr, size);
> break;
> }

Although this was not a real bug (__invalid_xchg_size() does not exist,
but is referenced to cause a deliberate link error), it is good to
clean this up.

Reviewed-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
i.e. will queue in the m68k tree for v6.11.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds