Re: [PATCH] err.h: use __always_inline on all error pointer helpers
From: Alexander Lobakin
Date: Tue May 26 2026 - 11:20:34 EST
From: Arnd Bergmann <arnd@xxxxxxxxxx>
Date: Tue, 26 May 2026 12:18:41 +0200
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> While testing randconfig builds on s390, I came across a
> link failure with CONFIG_DMA_SHARED_BUFFER disabled:
>
> ERROR: modpost: "dma_buf_put" [drivers/iommu/iommufd/iommufd.ko] undefined!
>
> The problem here is that IS_ERR() is not inlined and dead code elimination
> fails as a consequence.
>
> The err.h helpers all turn into a trivial assignment ot a bit mask
^^
or
(nit)
> and should never result in a function call, so force them to always be
> inline. This should generally result in better object code aside from
> avoiding the link failure above.
bloat-o-meter would be nice to see but optional, it's obvious to me that
these helpers should always get inlined.
Not sure why compilers sometimes decide to uninline a couple
instructions (feels like there's sorta dumb logic "oh it's used more
than X times -- uninline no matter what").
>
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
Reviewed-by: Alexander Lobakin <aleksander.lobakin@xxxxxxxxx>
Thanks,
Olek