Skip to contentSkip to conversation

acpi/numa/hmat: fix a section mismatch

PATCH In review Qian Cai 2 participants 2 messages Nov 11, 2019 – Nov 12, 2019 ACPI

lore
Share & tools
lore

Qian Cai

author
#0 lore raw

PATCH 1/1 acpi/numa/hmat: fix a section mismatch

The commit cf8741ac57ed ("ACPI: NUMA: HMAT: Register "soft reserved" memory as an "hmem" device") introduced a linker warning,

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

Since hmat_register_target() is also called from hmat_callback(), and then register_hotmemory_notifier() where it should not be freed when hmat_init() is done, it indicates the annotation of hmat_register_target_devices() is incorrect.

Fixes cf8741ac57ed ("ACPI: NUMA: HMAT: Register "soft reserved" memory as an "hmem" device")
---
 drivers/acpi/numa/hmat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/numa/hmat.c +1 -1
index 42cafeaac336..600ae3babd15 100644
@@ -694,7 +694,7 @@ static void hmat_register_target_device(struct memory_target *target,
 	memregion_free(id);
 }
 
-static __init void hmat_register_target_devices(struct memory_target *target)
+static void hmat_register_target_devices(struct memory_target *target)
 {
 	struct resource *res;
 
Signature · 1 line
2.21.0 (Apple Git-122.2)
#1 lore raw
Quoted 12 lines · Qian Cai

The commit cf8741ac57ed ("ACPI: NUMA: HMAT: Register "soft reserved" memory as an "hmem" device") introduced a linker warning,

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

Quoted 7 lines

Since hmat_register_target() is also called from hmat_callback(), and then register_hotmemory_notifier() where it should not be freed when hmat_init() is done, it indicates the annotation of hmat_register_target_devices() is incorrect.

Fixes cf8741ac57ed ("ACPI: NUMA: HMAT: Register "soft reserved" memory as an "hmem" device")

Applying with minor modifications of the subject and changelog, thanks!

Quoted 20 lines
---
 drivers/acpi/numa/hmat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/numa/hmat.c +1 -2
index 42cafeaac336..600ae3babd15 100644
@@ -694,7 +694,7 @@ static void hmat_register_target_device(struct memory_target *target,
        memregion_free(id);
 }
 
-static __init void hmat_register_target_devices(struct memory_target *target)
+static void hmat_register_target_devices(struct memory_target *target)
 {
        struct resource *res;
 
--

2.21.0 (Apple Git-122.2)