[PATCH] dmaengine: dw-edma: Clear chip->dw after removal

From: Koichiro Den

Date: Tue Nov 10 2026 - 03:57:42 EST


dw_edma_remove() unregisters the DMA device and releases its resources,
but leaves chip->dw set, so the pointer no longer indicates whether the
eDMA instance is still registered. Some in-tree glue drivers call
dw_pcie_ep_deinit() when dw_pcie_ep_init_registers() fails. If
initialization has already removed eDMA, deinitialization attempts to
tear down the same instance again.

Regardless of whether those error paths are reworked, clear chip->dw on
removal to match its assignment on successful probe. This also lets the
existing NULL check skip repeated teardown.

Fixes: 869bc5253406 ("PCI: dwc: ep: Fix DBI access failure for drivers requiring refclk from host")
Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
Closes: https://sashiko.dev/#/patchset/20261022082230.3164834-1-den@xxxxxxxxxxxxx?part=2
Signed-off-by: Koichiro Den <den@xxxxxxxxxxxxx>
---
drivers/dma/dw-edma/dw-edma-core.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
index d682074eaa0e..daa2084485d5 100644
--- a/drivers/dma/dw-edma/dw-edma-core.c
+++ b/drivers/dma/dw-edma/dw-edma-core.c
@@ -1509,6 +1509,8 @@ int dw_edma_remove(struct dw_edma_chip *chip)
list_del(&chan->vc.chan.device_node);
}

+ chip->dw = NULL;
+
return err;
}
EXPORT_SYMBOL_GPL(dw_edma_remove);

base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
--
2.54.0