DMA Engine development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tian Xuechen" <202300460064@mail.sdu.edu.cn>
Cc: dmaengine@vger.kernel.org, vkoul@kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH 1/3] dmaengine: stm32-dmamux: Unregister the DMA router on removal
Date: Fri, 27 Nov 2026 11:50:11 +0000	[thread overview]
Message-ID: <sashiko-outbox-237293@kernel.org> (raw)
In-Reply-To: <20261127113332.390552-2-202300460064@mail.sdu.edu.cn>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] dmaengine: stm32-dmamux: missing PM and clock cleanup in
  stm32_dmamux_remove()
--

commit 01371409f62942bd0d2c67aaa136651d1d8545c7
Author: Tian Xuechen <202300460064@mail.sdu.edu.cn>

dmaengine: stm32-dmamux: Unregister the DMA router on removal

This commit adds a platform driver remove callback to unregister the OF
DMA router when the stm32-dmamux device is unbound.

> diff --git a/drivers/dma/stm32/stm32-dmamux.c b/drivers/dma/stm32/stm32-dmamux.c
> index 57318715d9f34..6f49d78bfe3de 100644
> --- a/drivers/dma/stm32/stm32-dmamux.c
> +++ b/drivers/dma/stm32/stm32-dmamux.c
> @@ -389,8 +389,14 @@ static const struct of_device_id stm32_dmamux_match[] = {
>  	{},
>  };
>  
> +static void stm32_dmamux_remove(struct platform_device *pdev)
> +{
> +	of_dma_router_free(pdev->dev.of_node);
> +}
> +
>  static struct platform_driver stm32_dmamux_driver = {
>  	.probe	= stm32_dmamux_probe,
> +	.remove	= stm32_dmamux_remove,
>  	.driver = {
>  		.name = "stm32-dmamux",
>  		.of_match_table = stm32_dmamux_match,

[Severity: Medium]
Should stm32_dmamux_remove() also disable runtime PM and unprepare
stm32_dmamux->clk?

stm32_dmamux_probe() enables the clock and runtime PM without devm helpers
and unwinds them on error:

drivers/dma/stm32/stm32-dmamux.c:stm32_dmamux_probe() {
    ...
	ret = clk_prepare_enable(stm32_dmamux->clk);
    ...
	pm_runtime_set_active(&pdev->dev);
	pm_runtime_enable(&pdev->dev);
    ...
pm_disable:
	pm_runtime_disable(&pdev->dev);
err_clk:
	clk_disable_unprepare(stm32_dmamux->clk);
}

Without matching cleanup on removal, unbinding the device leaks the clock
prepare/enable reference and leaves runtime PM enabled on pdev->dev, which
causes a subsequent rebind to hit an unbalanced pm_runtime_enable()
warning.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127113332.390552-1-202300460064@mail.sdu.edu.cn?part=1

  reply	other threads:[~2026-11-27 11:50 UTC|newest]

Thread overview: 6+ 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 11:50   ` sashiko-bot [this message]
2026-11-27 11:33 ` [PATCH 2/3] dmaengine: stm32-dma: Unregister the OF controller and DMA device Tian Xuechen
2026-11-27 11:45   ` sashiko-bot
2026-11-27 11:33 ` [PATCH 3/3] dmaengine: stm32-mdma: Use managed OF DMA controller registration Tian Xuechen

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=sashiko-outbox-237293@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=202300460064@mail.sdu.edu.cn \
    --cc=Frank.Li@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --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