Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
* [PATCH] clk: imx: imx8qxp: add missing MODULE_DEVICE_TABLE()
@ 2026-07-05  0:17 Pengpeng Hou
  2026-07-05  0:28 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-07-05  0:17 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Frank Li,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
  Cc: Pengpeng Hou, linux-clk, imx, linux-arm-kernel, linux-kernel

The driver has a match table for the of bus wired into its driver
structure, but the table is not exported with MODULE_DEVICE_TABLE().

Add the missing MODULE_DEVICE_TABLE() entry so module alias information
is generated for automatic module loading.

This is a source-level fix.  It does not claim dynamic hardware
reproduction; the evidence is the driver-owned match table, its use by
the driver registration structure, and the missing module alias
publication.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 drivers/clk/imx/clk-imx8qxp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/imx/clk-imx8qxp.c b/drivers/clk/imx/clk-imx8qxp.c
index c781425a005e..1f6d9f45dad7 100644
--- a/drivers/clk/imx/clk-imx8qxp.c
+++ b/drivers/clk/imx/clk-imx8qxp.c
@@ -337,6 +337,7 @@ static const struct of_device_id imx8qxp_match[] = {
 	{ .compatible = "fsl,imx8qm-clk", &imx_clk_scu_rsrc_imx8qm, },
 	{ /* sentinel */ }
 };
+MODULE_DEVICE_TABLE(of, imx8qxp_match);
 
 static struct platform_driver imx8qxp_clk_driver = {
 	.driver = {
-- 
2.53.0


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

* Re: [PATCH] clk: imx: imx8qxp: add missing MODULE_DEVICE_TABLE()
  2026-07-05  0:17 [PATCH] clk: imx: imx8qxp: add missing MODULE_DEVICE_TABLE() Pengpeng Hou
@ 2026-07-05  0:28 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-07-05  0:28 UTC (permalink / raw)
  To: Pengpeng Hou; +Cc: imx, Frank.Li

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The driver lacks a `.remove` callback, which leaks CCF clocks on module unload and creates a use-after-free condition.
--

commit 61eb45335ff77dbb9e15e46999a551625f299716
Author: Pengpeng Hou <pengpeng@iscas.ac.cn>

clk: imx: imx8qxp: add missing MODULE_DEVICE_TABLE()

This commit adds the missing MODULE_DEVICE_TABLE() export for the driver's
match table. This ensures module alias information is generated, allowing
for automatic module loading.

> diff --git a/drivers/clk/imx/clk-imx8qxp.c b/drivers/clk/imx/clk-imx8qxp.c
> --- a/drivers/clk/imx/clk-imx8qxp.c
> +++ b/drivers/clk/imx/clk-imx8qxp.c
> @@ -337,6 +337,7 @@ static const struct of_device_id imx8qxp_match[] = {
>  	{ .compatible = "fsl,imx8qm-clk", &imx_clk_scu_rsrc_imx8qm, },
>  	{ /* sentinel */ }
>  };
> +MODULE_DEVICE_TABLE(of, imx8qxp_match);
>  
>  static struct platform_driver imx8qxp_clk_driver = {
>  	.driver = {
>  		.name = "imx8qxp-clk",
>  		.of_match_table = imx8qxp_match,
>  		.suppress_bind_attrs = true,
>  	},
>  	.probe = imx8qxp_clk_probe,
>  };

[Severity: High]
This is a pre-existing issue, but does unloading this module create a
use-after-free condition in the Common Clock Framework?

Because imx8qxp_clk_driver lacks a .remove callback, it does not seem to
call of_clk_del_provider() and imx_clk_scu_unregister() when the module
is unloaded. Since these clocks are not devm-managed, do they remain
active in the CCF?

If they stay active after the module is removed via rmmod, won't any
subsequent access to the clock tree trigger a panic, as the clock .ops
pointers will reference unloaded module memory?

Looking at drivers/clk/imx/clk-scu.c, the imx_clk_scu_driver sub-driver
also appears to lack a .remove callback to clean up CCF clocks and memory
when unregistered.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260705001705.70400-1-pengpeng@iscas.ac.cn?part=1

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

end of thread, other threads:[~2026-07-05  0:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-05  0:17 [PATCH] clk: imx: imx8qxp: add missing MODULE_DEVICE_TABLE() Pengpeng Hou
2026-07-05  0:28 ` sashiko-bot

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