Re: [PATCH v5 7/9] irqchip/imx-irqsteer: Allow building as module

[email protected]
Newsgroups dev.linux.lists.imx
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Unbalanced `pm_runtime_resume_and_get()` in `imx_irqsteer_remove()` leaks the PM runtime usage counter, breaking autosuspend upon module reload.
--

--- Patch [7]: [PATCH v5 7/9] irqchip/imx-irqsteer: Allow building as module ---
commit 392fba6a4866bd8979dac996d023521bdcba0251
Author: Jindong Yue <[email protected]>

irqchip/imx-irqsteer: Allow building as module

This patch makes the imx-irqsteer driver buildable as a module by changing
the Kconfig symbol to tristate. It also replaces builtin_platform_driver()
with module_platform_driver() and adds the necessary module metadata.

> diff --git a/drivers/irqchip/irq-imx-irqsteer.c b/drivers/irqchip/irq-imx-irqsteer.c
> index c2f58787f9a86..dad09e095ed1a 100644
> --- a/drivers/irqchip/irq-imx-irqsteer.c
> +++ b/drivers/irqchip/irq-imx-irqsteer.c

[ ... ]

> @@ -380,4 +382,7 @@ static struct platform_driver imx_irqsteer_driver = {
>  	.probe		= imx_irqsteer_probe,
>  	.remove		= imx_irqsteer_remove,
>  };
> -builtin_platform_driver(imx_irqsteer_driver);
> +module_platform_driver(imx_irqsteer_driver);

[Severity: Medium]
Will this leak the PM runtime usage counter on module unload?

When module unloading is enabled by this change, unloading the driver calls
imx_irqsteer_remove(). 

In that function, pm_runtime_resume_and_get() is called without a balancing
put:

drivers/irqchip/irq-imx-irqsteer.c:imx_irqsteer_remove() {
        ...
	pm_runtime_resume_and_get(&pdev->dev);
        ...
}

Because the driver core does not reset this usage count on device unbind,
and there is no balancing pm_runtime_put_noidle() before the function
exits, the PM runtime usage count is incremented permanently.

If the module is subsequently reloaded, will it start with an elevated
usage count, preventing the device from entering runtime suspend and leaving
its clock enabled indefinitely?

> +
> +MODULE_DESCRIPTION("i.MX IRQSTEER interrupt multiplexer/remapper driver");
> +MODULE_LICENSE("GPL");

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.