Skip to contentSkip to conversation

mtd: ubi: remove __exit annotation on ubiblock_exit

PATCH In review Arnd Bergmann 2 participants 2 messages Jul 19, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: ubi: remove __exit annotation on ubiblock_exit

From: Arnd Bergmann <[email protected]>

Calling an __exit function from an __init function leads to undefined behavior when the drier is built-in and the __exit functions are dropped from the object:

WARNING: modpost: drivers/mtd/ubi/ubi: section mismatch in reference: ubi_init+0xbe (section: .init.text) -> ubiblock_exit (section: .exit.text)
ERROR: modpost: Section mismatches detected.
Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.

Remove the now incorrect annotation.

Fixes 72f3d3daddd7 ("mtd: ubi: Restore missing cleanup on ubi_init() failure path")
---
 drivers/mtd/ubi/block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/ubi/block.c +1 -1
index bf7308e8ec2f..60d0155be869 100644
@@ -670,7 +670,7 @@ int __init ubiblock_init(void)
 	return ret;
 }
 
-void __exit ubiblock_exit(void)
+void ubiblock_exit(void)
 {
 	ubi_unregister_volume_notifier(&ubiblock_notifier);
 	ubiblock_remove_all();
Signature · 1 line
2.39.2
reviewer
#1 lore raw

在 2024/7/19 15:39, Arnd Bergmann 写道:
Hi, Arnd

Quoted 10 lines

From: Arnd Bergmann <[email protected]>

Calling an __exit function from an __init function leads to undefined behavior when the drier is built-in and the __exit functions are dropped from the object:

WARNING: modpost: drivers/mtd/ubi/ubi: section mismatch in reference: ubi_init+0xbe (section: .init.text) -> ubiblock_exit (section: .exit.text)
ERROR: modpost: Section mismatches detected.
Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.

Quoted 7 lines

Remove the now incorrect annotation.

Fixes 72f3d3daddd7 ("mtd: ubi: Restore missing cleanup on ubi_init() failure path")
---
  drivers/mtd/ubi/block.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Richard has sent the same modification, see
https://lore.kernel.org/linux-mtd/[email protected]/T/#mdefbd793992635f6a236a626dd7d3a296fb9820e

Quoted 15 lines
drivers/mtd/ubi/block.c +1 -1
index bf7308e8ec2f..60d0155be869 100644
@@ -670,7 +670,7 @@ int __init ubiblock_init(void)
  	return ret;
  }
 
-void __exit ubiblock_exit(void)
+void ubiblock_exit(void)
  {
  	ubi_unregister_volume_notifier(&ubiblock_notifier);
  	ubiblock_remove_all();