Add missing calls to bus_dmamap_unload() when freeing static DMA

allocations.

Reviewed by:	scottl
This commit is contained in:
jhb 2014-06-13 18:20:44 +00:00
parent 538796da60
commit 4b2862afcf
6 changed files with 20 additions and 2 deletions

View File

@ -477,20 +477,25 @@ amr_pci_free(struct amr_softc *sc)
bus_dma_tag_destroy(sc->amr_buffer64_dmat);
/* free and destroy DMA memory and tag for passthrough pool */
if (sc->amr_ccb)
if (sc->amr_ccb) {
bus_dmamap_unload(sc->amr_ccb_dmat, sc->amr_ccb_dmamap);
bus_dmamem_free(sc->amr_ccb_dmat, sc->amr_ccb, sc->amr_ccb_dmamap);
}
if (sc->amr_ccb_dmat)
bus_dma_tag_destroy(sc->amr_ccb_dmat);
/* free and destroy DMA memory and tag for s/g lists */
if (sc->amr_sgtable)
if (sc->amr_sgtable) {
bus_dmamap_unload(sc->amr_sg_dmat, sc->amr_sg_dmamap);
bus_dmamem_free(sc->amr_sg_dmat, sc->amr_sgtable, sc->amr_sg_dmamap);
}
if (sc->amr_sg_dmat)
bus_dma_tag_destroy(sc->amr_sg_dmat);
/* free and destroy DMA memory and tag for mailbox */
p = (void *)(uintptr_t)(volatile void *)sc->amr_mailbox64;
if (sc->amr_mailbox) {
bus_dmamap_unload(sc->amr_mailbox_dmat, sc->amr_mailbox_dmamap);
bus_dmamem_free(sc->amr_mailbox_dmat, p, sc->amr_mailbox_dmamap);
}
if (sc->amr_mailbox_dmat)

View File

@ -116,6 +116,7 @@ drm_ati_free_pcigart_table(struct drm_device *dev,
{
struct drm_dma_handle *dmah = gart_info->dmah;
bus_dmamap_unload(dmah->tag, dmah->map);
bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
bus_dma_tag_destroy(dmah->tag);
free(dmah, DRM_MEM_DMA);

View File

@ -119,6 +119,7 @@ drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah)
if (dmah == NULL)
return;
bus_dmamap_unload(dmah->tag, dmah->map);
bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
bus_dma_tag_destroy(dmah->tag);

View File

@ -116,6 +116,7 @@ drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah)
if (dmah == NULL)
return;
bus_dmamap_unload(dmah->tag, dmah->map);
bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
bus_dma_tag_destroy(dmah->tag);

View File

@ -1741,6 +1741,7 @@ isp_pci_mbxdma(ispsoftc_t *isp)
bad:
while (--cmap >= 0) {
struct isp_fc *fc = ISP_FC_PC(isp, cmap);
bus_dmamap_unload(fc->tdmat, fc->tdmap);
bus_dmamem_free(fc->tdmat, base, fc->tdmap);
bus_dma_tag_destroy(fc->tdmat);
while (fc->nexus_free_list) {
@ -1749,6 +1750,8 @@ isp_pci_mbxdma(ispsoftc_t *isp)
free(n, M_DEVBUF);
}
}
if (isp->isp_rquest_dma != 0)
bus_dmamap_unload(isp->isp_osinfo.cdmat, isp->isp_osinfo.cdmap);
bus_dmamem_free(isp->isp_osinfo.cdmat, base, isp->isp_osinfo.cdmap);
bus_dma_tag_destroy(isp->isp_osinfo.cdmat);
free(isp->isp_xflist, M_DEVBUF);

View File

@ -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