[PATCH v2] clk: scu/imx8qxp: do not register driver in probe()

Peng Fan peng.fan at nxp.com
Thu Feb 26 16:55:32 PST 2026


> Subject: Re: [PATCH v2] clk: scu/imx8qxp: do not register driver in
> probe()
> 
> On Wed Feb 25, 2026 at 9:16 AM CET, Peng Fan wrote:
> >>diff --git a/drivers/clk/imx/clk-imx8qxp.c
> >>b/drivers/clk/imx/clk-imx8qxp.c index
> 3ae162625bb1..c781425a005e
> >>100644
> >>--- a/drivers/clk/imx/clk-imx8qxp.c
> >>+++ b/drivers/clk/imx/clk-imx8qxp.c
> >>@@ -346,7 +346,29 @@ static struct platform_driver
> imx8qxp_clk_driver = {
> >> 	},
> >> 	.probe = imx8qxp_clk_probe,
> >> };
> >>-module_platform_driver(imx8qxp_clk_driver);
> >>+
> >>+static int __init imx8qxp_clk_init(void) {
> >>+	int ret;
> >>+
> >>+	ret = platform_driver_register(&imx8qxp_clk_driver);
> >>+	if (ret)
> >>+		return ret;
> >>+
> >>+	ret = imx_clk_scu_module_init();
> >>+	if (ret)
> >>+		platform_driver_unregister(&imx8qxp_clk_driver);
> >>+
> >>+	return ret;
> >>+}
> >>+module_init(imx8qxp_clk_init);
> >>+
> >>+static void __exit imx8qxp_clk_exit(void) {
> >>+	imx_clk_scu_module_exit();
> >>+	platform_driver_unregister(&imx8qxp_clk_driver);
> >>+}
> >>+module_exit(imx8qxp_clk_exit);
> >
> > The clk driver is critical for the system to work, removing this
> > driver will make the system not work properly I think, so it may not
> > make too much value to add an exit function here.
> 
> The exit function was there before, just hidden by the
> module_platform_driver() macro.
> 
> If a driver can be built as module, then we have to unregister the driver,
> when the module is unloaded.

I see. thanks!

Regards
Peng

> 
> If this driver should always be builtin, that is a separate change,
> independent from this fix.


More information about the linux-arm-kernel mailing list