On Mon, May 09, 2022 at 01:24:09PM +0100, Andrew Cooper wrote: > This is undefined behaviour, because there is no _spin_lock_cb() in a separate > translation unit (C11 6.7.4.11). > > Moreover, MISRA prohibits this construct because, in the case where it is well > defined, the compiler is free to use either implementation and nothing > prevents the two from being different.
>From my reading of the spec, using inline defined function with an extern declaration could allow the function to be (re)defined in the scope of a different compilation unit, kind of similar to the usage of the weak attribute? > This function has external users, so drop the inline. > > Spotted by Eclair MISRA scanner. Like wants a: Fixes: 462090402a ('spinlock: Introduce spin_lock_cb()') Thanks, Roger.