Skip to contentSkip to conversation

initramfs: fix another section mismatch

PATCH Applied Arnd Bergmann 2 participants 2 messages Apr 29, 2020 – Apr 30, 2020 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 initramfs: fix another section mismatch

Building with gcc-10 causes a harmless warning, similar to the gcc-4.6 warning that Geert fixed last year:

WARNING: modpost: vmlinux.o(.text.unlikely+0xe69): Section mismatch in reference from the function kexec_free_initrd() to the function .init.text:free_initrd_mem() The function kexec_free_initrd() references
the function __init free_initrd_mem().
This is often because kexec_free_initrd lacks a __init
annotation or the annotation of free_initrd_mem is wrong.

Add the missing __init annotations.

Fixes 4ada1e810038 ("initramfs: fix populate_initrd_image() section mismatch")
Fixes 23091e287355 ("initramfs: cleanup initrd freeing")
---
 init/initramfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
init/initramfs.c +2 -2
index 8ec1be4d7d51..bda77a6c8e50 100644
@@ -542,7 +542,7 @@ void __weak free_initrd_mem(unsigned long start, unsigned long end)
 }
 
 #ifdef CONFIG_KEXEC_CORE
-static bool kexec_free_initrd(void)
+static bool __init kexec_free_initrd(void)
 {
 	unsigned long crashk_start = (unsigned long)__va(crashk_res.start);
 	unsigned long crashk_end   = (unsigned long)__va(crashk_res.end);
@@ -565,7 +565,7 @@ static bool kexec_free_initrd(void)
 	return true;
 }
 #else
-static inline bool kexec_free_initrd(void)
+static inline bool __init kexec_free_initrd(void)
 {
 	return false;
 }
Signature · 1 line
2.26.0
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Arnd Bergmann

Building with gcc-10 causes a harmless warning, similar to the gcc-4.6 warning that Geert fixed last year:

WARNING: modpost: vmlinux.o(.text.unlikely+0xe69): Section mismatch in reference from the function kexec_free_initrd() to the function .init.text:free_initrd_mem() The function kexec_free_initrd() references
the function __init free_initrd_mem().
This is often because kexec_free_initrd lacks a __init
annotation or the annotation of free_initrd_mem is wrong.

Quoted 5 lines

Add the missing __init annotations.

Fixes 4ada1e810038 ("initramfs: fix populate_initrd_image() section mismatch")
Fixes 23091e287355 ("initramfs: cleanup initrd freeing")
Quoted 29 lines
---
 init/initramfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
init/initramfs.c +2 -2
index 8ec1be4d7d51..bda77a6c8e50 100644
@@ -542,7 +542,7 @@ void __weak free_initrd_mem(unsigned long start, unsigned long end)
 }
 
 #ifdef CONFIG_KEXEC_CORE
-static bool kexec_free_initrd(void)
+static bool __init kexec_free_initrd(void)
 {
 	unsigned long crashk_start = (unsigned long)__va(crashk_res.start);
 	unsigned long crashk_end   = (unsigned long)__va(crashk_res.end);
@@ -565,7 +565,7 @@ static bool kexec_free_initrd(void)
 	return true;
 }
 #else
-static inline bool kexec_free_initrd(void)
+static inline bool __init kexec_free_initrd(void)
 {
 	return false;
 }
Signature · 1 line
2.26.0
Signature · 2 lines
Sincerely yours,
Mike.