diff options
author | John Baldwin <jhb@FreeBSD.org> | 2014-06-17 14:47:49 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2014-06-17 14:47:49 +0000 |
commit | c34f1a08c676b01b6115e83dfe7052d55556c702 (patch) | |
tree | 237a911762e2e217590604019af2bd80f748d18c /sys/dev/oce | |
parent | 31bcfda84ec3ad17f6f827869991e465c4ece894 (diff) | |
download | src-c34f1a08c676b01b6115e83dfe7052d55556c702.tar.gz src-c34f1a08c676b01b6115e83dfe7052d55556c702.zip |
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
Notes
Notes:
svn path=/head/; revision=267580
Diffstat (limited to 'sys/dev/oce')
-rw-r--r-- | sys/dev/oce/oce_util.c | 4 |
1 files changed, 2 insertions, 2 deletions
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; } |