init: provide a generic free_initmem implementation

Patch series "provide a generic free_initmem implementation", v2.

Many architectures implement free_initmem() in exactly the same or very
similar way: they wrap the call to free_initmem_default() with sometimes
different 'poison' parameter.

These patches switch those architectures to use a generic implementation
that does free_initmem_default(POISON_FREE_INITMEM).

This was inspired by Christoph's patches for free_initrd_mem [1] and I
shamelessly copied changelog entries from his patches :)


This patch (of 2):

For most architectures free_initmem just a wrapper for the same
free_initmem_default(-1) call.  Provide that as a generic implementation
marked __weak.

Signed-off-by: Mike Rapoport <>
Reviewed-by: Andrew Morton <>
Cc: Christoph Hellwig <>
Cc: Palmer Dabbelt <>
Cc: Richard Kuo <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>
12 files changed