Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jun 2014 18:20:45 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r267446 - in head/sys/dev: amr drm drm2 isp mlx
Message-ID:  <201406131820.s5DIKjEk046100@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Fri Jun 13 18:20:44 2014
New Revision: 267446
URL: http://svnweb.freebsd.org/changeset/base/267446

Log:
  Add missing calls to bus_dmamap_unload() when freeing static DMA
  allocations.
  
  Reviewed by:	scottl

Modified:
  head/sys/dev/amr/amr_pci.c
  head/sys/dev/drm/ati_pcigart.c
  head/sys/dev/drm/drm_pci.c
  head/sys/dev/drm2/drm_pci.c
  head/sys/dev/isp/isp_pci.c
  head/sys/dev/mlx/mlx.c

Modified: head/sys/dev/amr/amr_pci.c
==============================================================================
--- head/sys/dev/amr/amr_pci.c	Fri Jun 13 18:07:42 2014	(r267445)
+++ head/sys/dev/amr/amr_pci.c	Fri Jun 13 18:20:44 2014	(r267446)
@@ -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)

Modified: head/sys/dev/drm/ati_pcigart.c
==============================================================================
--- head/sys/dev/drm/ati_pcigart.c	Fri Jun 13 18:07:42 2014	(r267445)
+++ head/sys/dev/drm/ati_pcigart.c	Fri Jun 13 18:20:44 2014	(r267446)
@@ -116,6 +116,7 @@ drm_ati_free_pcigart_table(struct drm_de
 {
 	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);

Modified: head/sys/dev/drm/drm_pci.c
==============================================================================
--- head/sys/dev/drm/drm_pci.c	Fri Jun 13 18:07:42 2014	(r267445)
+++ head/sys/dev/drm/drm_pci.c	Fri Jun 13 18:20:44 2014	(r267446)
@@ -119,6 +119,7 @@ drm_pci_free(struct drm_device *dev, drm
 	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);
 

Modified: head/sys/dev/drm2/drm_pci.c
==============================================================================
--- head/sys/dev/drm2/drm_pci.c	Fri Jun 13 18:07:42 2014	(r267445)
+++ head/sys/dev/drm2/drm_pci.c	Fri Jun 13 18:20:44 2014	(r267446)
@@ -116,6 +116,7 @@ drm_pci_free(struct drm_device *dev, drm
 	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);
 

Modified: head/sys/dev/isp/isp_pci.c
==============================================================================
--- head/sys/dev/isp/isp_pci.c	Fri Jun 13 18:07:42 2014	(r267445)
+++ head/sys/dev/isp/isp_pci.c	Fri Jun 13 18:20:44 2014	(r267446)
@@ -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 @@ bad:
 			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);

Modified: head/sys/dev/mlx/mlx.c
==============================================================================
--- head/sys/dev/mlx/mlx.c	Fri Jun 13 18:07:42 2014	(r267445)
+++ head/sys/dev/mlx/mlx.c	Fri Jun 13 18:20:44 2014	(r267446)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406131820.s5DIKjEk046100>