Re: [PATCH] dmaengine: mcf-edma: unregister DMA device before vchan cleanup

From: Frank Li

Date: Fri Nov 13 2026 - 14:58:52 EST


On Tue, Nov 03, 2026 at 11:33:24PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@xxxxxxx>
>
> mcf_edma_remove() calls fsl_edma_cleanup_vchan() before
> dma_async_device_unregister(). The cleanup helper removes every
> channel from dma_dev.channels, so dma_async_device_unregister() later
> sees an empty list and never unregisters the channel devices.
>
> This leaves dmaNchanM devices in sysfs, keeps their IOMMU groups alive
> and skips freeing the channel IDs and per-channel state when the
> controller is unbound or the driver is removed.
>
> Unregister the DMA device first, then run the vchan cleanup so the
> channel list is still intact when dma_async_device_unregister()
> iterates it.
>
> Fixes: e7a3ff92eaf19eab14e8149758428e680c61706b ("dmaengine: fsl-edma: add ColdFire mcf5441x edma support")
> Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
> ---

Reviewed-by: Frank Li <Frank.Li@xxxxxxx>

> drivers/dma/mcf-edma-main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma/mcf-edma-main.c b/drivers/dma/mcf-edma-main.c
> index 9e1c6400c77b..2efd5f0b4f87 100644
> --- a/drivers/dma/mcf-edma-main.c
> +++ b/drivers/dma/mcf-edma-main.c
> @@ -258,8 +258,8 @@ static void mcf_edma_remove(struct platform_device *pdev)
> struct fsl_edma_engine *mcf_edma = platform_get_drvdata(pdev);
>
> mcf_edma_irq_free(pdev, mcf_edma);
> - fsl_edma_cleanup_vchan(&mcf_edma->dma_dev);
> dma_async_device_unregister(&mcf_edma->dma_dev);
> + fsl_edma_cleanup_vchan(&mcf_edma->dma_dev);
> }
>
> static struct platform_driver mcf_edma_driver = {
>
> ---
> base-commit: d6bcfc94eb4da6e089c5473970cd96727292fd97
> change-id: 20261103-mcf-edma-c7a06df69dbd
>
> Best regards,
> --
> Peng Fan <peng.fan@xxxxxxx>
>