From c34f1a08c676b01b6115e83dfe7052d55556c702 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Tue, 17 Jun 2014 14:47:49 +0000 Subject: Fix teardown of static DMA allocations in various NIC drivers: - Add missing calls to bus_dmamap_unload() in et(4). - Check the bus address against 0 to decide when to call bus_dmamap_unload() instead of comparing the bus_dma map against NULL. - Check the virtual address against NULL to decide when to call bus_dmamem_free() instead of comparing the bus_dma map against NULL. - Don't clear bus_dma map pointers to NULL for static allocations. Instead, treat the value as completely opaque. - Pass the correct virtual address to bus_dmamem_free() in wpi(4) instead of trying to free a pointer to the virtual address. Reviewed by: yongari --- sys/dev/oce/oce_util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys/dev/oce') diff --git a/sys/dev/oce/oce_util.c b/sys/dev/oce/oce_util.c index 669da0367858..9ae92ff05f16 100644 --- a/sys/dev/oce/oce_util.c +++ b/sys/dev/oce/oce_util.c @@ -105,15 +105,15 @@ oce_dma_free(POCE_SOFTC sc, POCE_DMA_MEM dma) if (dma->tag == NULL) return; - if (dma->map != NULL) { + if (dma->paddr != 0) { bus_dmamap_sync(dma->tag, dma->map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(dma->tag, dma->map); + dma->paddr = 0; } if (dma->ptr != NULL) { bus_dmamem_free(dma->tag, dma->ptr, dma->map); - dma->map = NULL; dma->ptr = NULL; } -- cgit v1.3