DMA Engine development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Rosen Penev" <rosenp@gmail.com>
Cc: Frank.Li@kernel.org, dmaengine@vger.kernel.org, vkoul@kernel.org
Subject: Re: [PATCH] dmaengine: at_hdmac: use more devm in _probe
Date: Thu, 23 Jul 2026 05:16:43 +0000	[thread overview]
Message-ID: <20260723051643.F34461F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260723050732.290935-1-rosenp@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] DMA channels are manually unlinked from the device list before devres executes `dmaenginem_async_device_unregister()`, leading to permanent memory leaks and sysfs name conflicts that break driver reload.
--

--- Patch [1]: [PATCH] dmaengine: at_hdmac: use more devm in _probe ---
commit c530cb83f3773c6a30cecc88fcb10f7ec0a53e60
Author: Rosen Penev <rosenp@gmail.com>

dmaengine: at_hdmac: use more devm in _probe
    
As devm is already used in _probe, complete the conversion so that
everything unwinds in proper order.

> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index e5b30a57c477a..25d846ed7a7bd 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c

[ ... ]

> @@ -2121,13 +2103,6 @@ static void at_dma_remove(struct platform_device *pdev)
>  	struct dma_chan		*chan, *_chan;
>  
>  	at_dma_off(atdma);
> -	if (pdev->dev.of_node)
> -		of_dma_controller_free(pdev->dev.of_node);
> -	dma_async_device_unregister(&atdma->dma_device);
> -
> -	dma_pool_destroy(atdma->memset_pool);
> -	dma_pool_destroy(atdma->lli_pool);
> -	free_irq(platform_get_irq(pdev, 0), atdma);
>  
>  	list_for_each_entry_safe(chan, _chan, &atdma->dma_device.channels,
>  			device_node) {
> @@ -2135,8 +2110,6 @@ static void at_dma_remove(struct platform_device *pdev)
>  		atc_disable_chan_irq(atdma, chan->chan_id);
>  		list_del(&chan->device_node);

[Severity: High]
Will unlinking the channels here prevent dmaenginem_async_device_unregister()
from cleaning them up?

Because devres handles dmaenginem_async_device_unregister() after
at_dma_remove() returns, the unregister function will iterate over the
now-empty &atdma->dma_device.channels list.

Does this skip the channel unregistration process, leaking the chan->local
per-CPU memory and chan->dev sysfs nodes? 

If the sysfs nodes remain, won't reloading the driver fail due to sysfs name
conflicts?

>  	}
> -
> -	clk_disable_unprepare(atdma->clk);
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260723050732.290935-1-rosenp@gmail.com?part=1

      reply	other threads:[~2026-07-23  5:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23  5:07 [PATCH] dmaengine: at_hdmac: use more devm in _probe Rosen Penev
2026-07-23  5:16 ` sashiko-bot [this message]

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=20260723051643.F34461F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=rosenp@gmail.com \
    --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