git: d1488cd762be - main - bcm2835_sdhci: Clean up DMA resources on attach failure
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 27 May 2026 18:22:57 UTC
The branch main has been updated by mhorne:
URL: https://cgit.FreeBSD.org/src/commit/?id=d1488cd762bee79240a715bf04f3d30e9a121b26
commit d1488cd762bee79240a715bf04f3d30e9a121b26
Author: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
AuthorDate: 2026-05-27 02:42:43 +0000
Commit: Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2026-05-27 18:12:09 +0000
bcm2835_sdhci: Clean up DMA resources on attach failure
bcm_sdhci_attach() allocates a DMA channel with bcm_dma_allocate()
before creating the bus_dma tag and map. If a later initialization
step fails, the common error path releases the interrupt and memory
resources, but leaves the DMA channel allocated.
Call bcm_dma_free() for cleanup, as it already performs the required
internal checks and can therefore be invoked directly.
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Reviewed by: mhorne
MFC after: 3 days
Pull Request: https://github.com/freebsd/freebsd-src/pull/2241
---
sys/arm/broadcom/bcm2835/bcm2835_sdhci.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c b/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c
index e0c4327d8e05..6e974a1a61bb 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c
@@ -365,6 +365,7 @@ bcm_sdhci_attach(device_t dev)
return (0);
fail:
+ bcm_dma_free(sc->sc_dma_ch);
if (sc->sc_intrhand)
bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_intrhand);
if (sc->sc_irq_res)