Re: [PATCH] serial: 8250: Fix section mismatch with CONFIG_MODULES=n

From: Danish Khateeb

Date: Sun Sep 27 2026 - 10:01:33 EST


Hello Uwe,

On Sat, Sep 26, 2026 at 07:40:03PM +0200, Uwe Kleine-König wrote:
> Isn't that a false positive because with CONFIG_MODULES=n .exit is
> discarded and so the section mismatch doesn't matter?

Yes, it's harmless at runtime, but modpost still warns on every
CONFIG_MODULES=n build with SERIAL_8250_PNP (e.g. kunit.py --alltests),
and the build fails with CONFIG_SECTION_MISMATCH_WARN_ONLY=n.

> I thought __init_or_module was the right annotation ...

It is, modpost just doesn't know that. Without it the two helpers stay in
memory after boot, 16 bytes each on x86_64. The alternative is teaching
modpost to skip exit -> init references in vmlinux when CONFIG_MODULES=n.

Thanks
Danish