From: Danish Khateeb <danishkhateeb03@gmail.com>
To: gregkh@linuxfoundation.org, jirislaby@kernel.org
Cc: u.kleine-koenig@baylibre.com, andriy.shevchenko@linux.intel.com,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
Danish Khateeb <danishkhateeb03@gmail.com>
Subject: [PATCH] serial: 8250: Fix section mismatch with CONFIG_MODULES=n
Date: Sat, 26 Sep 2026 11:35:06 -0500 [thread overview]
Message-ID: <20260926163506.487201-1-danishkhateeb03@gmail.com> (raw)
Without CONFIG_MODULES, __init_or_module means __init, so
serial8250_pnp_exit() and serial8250_hub6_exit() end up in .init.text.
They are also called from serial8250_exit(), which is __exit, and
modpost warns:
WARNING: modpost: vmlinux: section mismatch in reference: serial8250_exit+0x2a (section: .exit.text) -> serial8250_pnp_exit (section: .init.text)
The exit code never runs in such a kernel, so nothing breaks at runtime.
But a function that is called from both __init and __exit code can't
carry either annotation, so drop it.
Fixes: a300273c458c ("serial: 8250: hub6: Add cleanup code")
Fixes: 4cf187f9dea9 ("serial: 8250: pnp: Annotate init and exit functions for conditional discarding")
Assisted-by: LLM
Signed-off-by: Danish Khateeb <danishkhateeb03@gmail.com>
---
Notes:
Tested on tty-next bf961847813d:
- x86_64 defconfig with MODULES=n warns for serial8250_pnp_exit(), and
i386 defconfig with MODULES=n, ISA and SERIAL_8250_HUB6 also warns for
serial8250_hub6_exit(). Neither warns before a300273c458c. With this
patch both build without warnings, and so does x86_64 defconfig.
- Both MODULES=n kernels still register ttyS0 through 8250_pnp in QEMU.
drivers/tty/serial/8250/8250_hub6.c | 2 +-
drivers/tty/serial/8250/8250_pnp.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_hub6.c b/drivers/tty/serial/8250/8250_hub6.c
index 4d4c54c951cb..848d9723ac56 100644
--- a/drivers/tty/serial/8250/8250_hub6.c
+++ b/drivers/tty/serial/8250/8250_hub6.c
@@ -54,7 +54,7 @@ int __init serial8250_hub6_init(void)
return platform_device_register(&hub6_device);
}
-void __init_or_module serial8250_hub6_exit(void)
+void serial8250_hub6_exit(void)
{
platform_device_unregister(&hub6_device);
}
diff --git a/drivers/tty/serial/8250/8250_pnp.c b/drivers/tty/serial/8250/8250_pnp.c
index 7decf62400ab..a6257cd6e246 100644
--- a/drivers/tty/serial/8250/8250_pnp.c
+++ b/drivers/tty/serial/8250/8250_pnp.c
@@ -531,7 +531,7 @@ int __init serial8250_pnp_init(void)
return pnp_register_driver(&serial_pnp_driver);
}
-void __init_or_module serial8250_pnp_exit(void)
+void serial8250_pnp_exit(void)
{
pnp_unregister_driver(&serial_pnp_driver);
}
base-commit: bf961847813d9edcb5a9c089714069428d141fa9
--
2.55.0
next reply other threads:[~2026-09-26 16:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-26 16:35 Danish Khateeb [this message]
2026-09-26 17:40 ` Uwe Kleine-König
2026-09-27 14:00 ` Danish Khateeb
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260926163506.487201-1-danishkhateeb03@gmail.com \
--to=danishkhateeb03@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=u.kleine-koenig@baylibre.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®