Re: [PATCH] ata: pata_pxa: use devres for DMA channel management

[email protected] Mon, 20 Jul 2026 02:01:48 +0000
Newsgroups org.kernel.vger.linux-ide
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The commit message falsely claims that `ata_host_activate()` registers a managed host detach and that the patch preserves the previous teardown ordering.
--

--- Patch [1]: [PATCH] ata: pata_pxa: use devres for DMA channel management ---
commit d581effc5d41a82779ae2b411de235a8efbfb017
Author: Rosen Penev <[email protected]>

ata: pata_pxa: use devres for DMA channel management

Convert the DMA channel request to devm_dma_request_chan() so the
channel is released automatically on device teardown. This removes
the explicit dma_release_channel() calls in the probe error paths
and in pxa_ata_remove().

> Devres releases in LIFO order, so the managed host detach registered
> by ata_host_activate() runs before the DMA channel is released, which
> preserves the previous teardown ordering.

[Severity: Medium]
Is this description accurate regarding the managed host detach and teardown
ordering?

Looking at ata_host_activate(), it does not appear to register a managed
host detach.

Additionally, pxa_ata_remove() retains the explicit call to
ata_host_detach():

> diff --git a/drivers/ata/pata_pxa.c b/drivers/ata/pata_pxa.c
> --- a/drivers/ata/pata_pxa.c
> +++ b/drivers/ata/pata_pxa.c
[ ... ]
> @@ -280,33 +280,26 @@ static int pxa_ata_probe(struct platform_device *pdev)
[ ... ]
>  static void pxa_ata_remove(struct platform_device *pdev)
>  {
>  	struct ata_host *host = platform_get_drvdata(pdev);
> -	struct pata_pxa_data *data = host->ports[0]->private_data;
> -
> -	dma_release_channel(data->dma_chan);
>  
>  	ata_host_detach(host);
>  }

Because devres cleanup executes after pxa_ata_remove() returns, the DMA
channel is now released after the host is explicitly detached. This reverses
the previous teardown ordering, which released the DMA channel before the
host detach. Could the commit message be more precise about the actual
teardown sequence?

-- 
Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1