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

From: Thorsten Blum
Date: Wed Jul 03 2024 - 15:02:58 EST


On 2. Jul 2024, at 00:21, Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
>
> 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.

Thank you for explaining this. I was already wondering why I couldn't
find the function definition.

Thorsten