Re: [PATCH 02/10] dmaengine: ae4dma: Unregister DMA engine in ae4_pci_remove()

From: Lee Jones

Date: Tue Nov 17 2026 - 05:38:29 EST


On Tue, 17 Nov 2026, Basavaraj Natikar wrote:

> Hi,
>
>
> On 11/12/2026 3:22 AM, Lee Jones wrote:
> > [You don't often get email from lee@xxxxxxxxxx. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> >
> > ae4_core_init() registers the DMA device and creates the descriptor slab
> > cache via pt_dmaengine_register(), but ae4_pci_remove() never calls
> > pt_dmaengine_unregister(), leaking the descriptor cache and leaving a
> > dangling DMA device registered after device removal.
> >
> > Export pt_dmaengine_unregister() and call it from ae4_pci_remove().
> >
> > Fixes: 98f5a4432622 ("dmaengine: ae4dma: Register AE4DMA using pt_dmaengine_register")
> > Closes: https://sashiko.dev/#/bug/linux-10d41112-e133-4bc5-8e53-b3e96592c70d
> > Cc: stable@xxxxxxxxxxxxxxx
> > Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
> > ---
> > drivers/dma/amd/ae4dma/ae4dma-pci.c | 1 +
> > drivers/dma/amd/ptdma/ptdma-dmaengine.c | 1 +
> > 2 files changed, 2 insertions(+)
> >
> > diff --git a/drivers/dma/amd/ae4dma/ae4dma-pci.c b/drivers/dma/amd/ae4dma/ae4dma-pci.c
> > index 2c63907db228..8712f4f65e28 100644
> > --- a/drivers/dma/amd/ae4dma/ae4dma-pci.c
> > +++ b/drivers/dma/amd/ae4dma/ae4dma-pci.c
> > @@ -132,6 +132,7 @@ static void ae4_pci_remove(struct pci_dev *pdev)
> > {
> > struct ae4_device *ae4 = dev_get_drvdata(&pdev->dev);
> >
> > + pt_dmaengine_unregister(&ae4->pt);
>
> The cache must remain valid until completion processing is quiesced.
> pt_dmaengine_unregister() currently destroys it before ae4_destroy_work().
>
> However, merely reversing these calls is insufficient: the existing worker
> loops indefinitely, so cancel_delayed_work_sync() can hang. We need a
> teardown sequence that safely stops DMA/completion activity before
> destroying the descriptor cache.

I'll look into that. Thank you.

--
Lee Jones