Re: [PATCH] of: reserved_mem: mark the early_memremap() array helpers __init

From: Rob Herring (Arm)

Date: Fri Nov 06 2026 - 16:32:22 EST



On Mon, 02 Nov 2026 17:45:28 -0500, Sasha Levin wrote:
> early_array_map() and early_array_unmap() wrap early_memremap() and
> early_memunmap(), which are __init, but the helpers themselves are only
> static inline. If the compiler decides not to inline them, the out of
> line copy ends up in .text and modpost complains. clang 21 does this for
> a riscv allnoconfig build:
>
> WARNING: modpost: vmlinux: section mismatch in reference: early_array_map+0x30 (section: .text) -> early_memremap (section: .init.text)
> ERROR: modpost: Section mismatches detected.
>
> Both helpers are only called from fdt_scan_reserved_mem(), which is
> __init, so mark them __init too.
>
> Fixes: aa05faf81583 ("of: reserved_mem: allocate and map the reserved_mem array early")
> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
> ---
> KernelCI's clang-21 riscv builds fail on this once dt/for-next is
> merged, so it will probably show up in tomorrow's linux-next as well.
>
> Tested with a riscv LLVM=1 allnoconfig build (fails at modpost before,
> links after), plus W=1 builds of of_reserved_mem.o for riscv and arm64
> defconfig with clang, and arm64 defconfig with gcc.
>
> drivers/of/of_reserved_mem.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>

Applied, thanks!