From: Frank Li <Frank.li@oss.nxp.com>
To: Tian Xuechen <202300460064@mail.sdu.edu.cn>
Cc: amelie.delaunay@foss.st.com, vkoul@kernel.org,
mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com,
cedric.madianga@gmail.com, pierre-yves.mordret@st.com,
Frank.Li@kernel.org, dmaengine@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/3] dmaengine: stm32-dma: Unregister the OF controller and DMA device
Date: Fri, 27 Nov 2026 09:14:58 -0600 [thread overview]
Message-ID: <awmecq4gSJjJC6f2@SMW015318> (raw)
In-Reply-To: <20261127113332.390552-3-202300460064@mail.sdu.edu.cn>
On Fri, Nov 27, 2026 at 07:33:31PM +0800, Tian Xuechen wrote:
> From: Tian Xuechen <202300460064@mail.sdu.edu.cn>
>
> The OF controller and DMA engine remain registered after the driver
> releases its channel data. Unregister both in reverse order when the
> device is removed.
>
> This issue was found by our static analysis tool under development.
>
> Fixes: d8b468394fb7 ("dmaengine: Add STM32 DMA driver")
> Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
> ---
> drivers/dma/stm32/stm32-dma.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/dma/stm32/stm32-dma.c b/drivers/dma/stm32/stm32-dma.c
> index ba8121d37f51..6392c15b4317 100644
> --- a/drivers/dma/stm32/stm32-dma.c
> +++ b/drivers/dma/stm32/stm32-dma.c
> @@ -1761,6 +1761,14 @@ static const struct dev_pm_ops stm32_dma_pm_ops = {
> stm32_dma_runtime_resume, NULL)
> };
>
> +static void stm32_dma_remove(struct platform_device *pdev)
> +{
> + struct stm32_dma_device *dmadev = platform_get_drvdata(pdev);
> +
> + of_dma_controller_free(pdev->dev.of_node);
> + dma_async_device_unregister(&dmadev->ddev);
> +}
> +
Please use manange APIs to fix this problem
Frank
> static struct platform_driver stm32_dma_driver = {
> .driver = {
> .name = "stm32-dma",
> @@ -1768,6 +1776,7 @@ static struct platform_driver stm32_dma_driver = {
> .pm = &stm32_dma_pm_ops,
> },
> .probe = stm32_dma_probe,
> + .remove = stm32_dma_remove,
> };
>
> static int __init stm32_dma_init(void)
>
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-11-27 15:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 11:33 [PATCH 0/3] dmaengine: stm32: Pair DMA provider registration with cleanup Tian Xuechen
2026-11-27 11:33 ` [PATCH 1/3] dmaengine: stm32-dmamux: Unregister the DMA router on removal Tian Xuechen
2026-11-27 15:15 ` Frank Li
2026-11-27 11:33 ` [PATCH 2/3] dmaengine: stm32-dma: Unregister the OF controller and DMA device Tian Xuechen
2026-11-27 15:14 ` Frank Li [this message]
2026-11-27 11:33 ` [PATCH 3/3] dmaengine: stm32-mdma: Use managed OF DMA controller registration Tian Xuechen
2026-11-27 14:48 ` [PATCH 0/3] dmaengine: stm32: Pair DMA provider registration with cleanup Amelie Delaunay
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=awmecq4gSJjJC6f2@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=202300460064@mail.sdu.edu.cn \
--cc=Frank.Li@kernel.org \
--cc=alexandre.torgue@foss.st.com \
--cc=amelie.delaunay@foss.st.com \
--cc=cedric.madianga@gmail.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=pierre-yves.mordret@st.com \
--cc=vkoul@kernel.org \
/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