mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mtd: ubi: remove __exit annotation on ubiblock_exit
@ 2024-07-19  7:39 Arnd Bergmann
  2024-07-19  8:09 ` Zhihao Cheng
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2024-07-19  7:39 UTC (permalink / raw)
  To: Richard Weinberger, Miquel Raynal, Vignesh Raghavendra, Ben Hutchings
  Cc: Arnd Bergmann, Zhihao Cheng, Li Nan, Daniel Golle, Jens Axboe,
	ZhaoLong Wang, linux-mtd, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mtd/ubi/block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
index bf7308e8ec2f..60d0155be869 100644
--- a/drivers/mtd/ubi/block.c
+++ b/drivers/mtd/ubi/block.c
@@ -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();
-- 
2.39.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mtd: ubi: remove __exit annotation on ubiblock_exit
  2024-07-19  7:39 [PATCH] mtd: ubi: remove __exit annotation on ubiblock_exit Arnd Bergmann
@ 2024-07-19  8:09 ` Zhihao Cheng
  0 siblings, 0 replies; 2+ messages in thread
From: Zhihao Cheng @ 2024-07-19  8:09 UTC (permalink / raw)
  To: Arnd Bergmann, Richard Weinberger, Miquel Raynal,
	Vignesh Raghavendra, Ben Hutchings
  Cc: Arnd Bergmann, Li Nan, Daniel Golle, Jens Axboe, ZhaoLong Wang,
	linux-mtd, linux-kernel

在 2024/7/19 15:39, Arnd Bergmann 写道:
Hi, Arnd
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   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/9a210424-eac1-957e-dd6e-4290924216e3@huawei.com/T/#mdefbd793992635f6a236a626dd7d3a296fb9820e

> 
> diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
> index bf7308e8ec2f..60d0155be869 100644
> --- a/drivers/mtd/ubi/block.c
> +++ b/drivers/mtd/ubi/block.c
> @@ -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();
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-07-19  8:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-19  7:39 [PATCH] mtd: ubi: remove __exit annotation on ubiblock_exit Arnd Bergmann
2024-07-19  8:09 ` Zhihao Cheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®