diff options
Diffstat (limited to 'sys/dev/mlx/mlx.c')
-rw-r--r-- | sys/dev/mlx/mlx.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/dev/mlx/mlx.c b/sys/dev/mlx/mlx.c index ddcf4b0598bc..0f92eaf35385 100644 --- a/sys/dev/mlx/mlx.c +++ b/sys/dev/mlx/mlx.c @@ -191,6 +191,8 @@ mlx_free(struct mlx_softc *sc) bus_dma_tag_destroy(sc->mlx_buffer_dmat); /* free and destroy DMA memory and tag for s/g lists */ + if (sc->mlx_sgbusaddr) + bus_dmamap_unload(sc->mlx_sg_dmat, sc->mlx_sg_dmamap); if (sc->mlx_sgtable) bus_dmamem_free(sc->mlx_sg_dmat, sc->mlx_sgtable, sc->mlx_sg_dmamap); if (sc->mlx_sg_dmat) @@ -239,10 +241,15 @@ mlx_sglist_map(struct mlx_softc *sc) debug_called(1); /* destroy any existing mappings */ + if (sc->mlx_sgbusaddr) + bus_dmamap_unload(sc->mlx_sg_dmat, sc->mlx_sg_dmamap); if (sc->mlx_sgtable) bus_dmamem_free(sc->mlx_sg_dmat, sc->mlx_sgtable, sc->mlx_sg_dmamap); if (sc->mlx_sg_dmat) bus_dma_tag_destroy(sc->mlx_sg_dmat); + sc->mlx_sgbusaddr = 0; + sc->mlx_sgtable = NULL; + sc->mlx_sg_dmat = NULL; /* * Create a single tag describing a region large enough to hold all of |