Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Jun 2014 20:25:46 +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: r267340 - in head/sys: arm/versatile dev/advansys dev/an dev/ata dev/buslogic dev/dpt dev/hifn dev/malo dev/mwl dev/safe dev/sym dev/trm dev/tx dev/ubsec
Message-ID:  <201406102025.s5AKPkeM001001@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Tue Jun 10 20:25:45 2014
New Revision: 267340
URL: http://svnweb.freebsd.org/changeset/base/267340

Log:
  Don't destroy bus_dma maps created by bus_dmamem_alloc().  In some cases,
  don't create a map before calling bus_dmamem_alloc() (such maps were
  leaked).  It is believed that the extra destroy of the map was generally
  harmless since bus_dmamem_alloc() often uses special maps for which
  bus_dmamap_destroy() is a no-op (e.g. on x86).
  
  Reviewed by:	scottl

Modified:
  head/sys/arm/versatile/versatile_clcd.c
  head/sys/dev/advansys/adwcam.c
  head/sys/dev/an/if_an.c
  head/sys/dev/ata/ata-dma.c
  head/sys/dev/buslogic/bt.c
  head/sys/dev/dpt/dpt_scsi.c
  head/sys/dev/hifn/hifn7751.c
  head/sys/dev/malo/if_malo.c
  head/sys/dev/malo/if_malohal.c
  head/sys/dev/mwl/if_mwl.c
  head/sys/dev/mwl/mwlhal.c
  head/sys/dev/safe/safe.c
  head/sys/dev/sym/sym_hipd.c
  head/sys/dev/trm/trm.c
  head/sys/dev/tx/if_tx.c
  head/sys/dev/ubsec/ubsec.c

Modified: head/sys/arm/versatile/versatile_clcd.c
==============================================================================
--- head/sys/arm/versatile/versatile_clcd.c	Tue Jun 10 19:00:14 2014	(r267339)
+++ head/sys/arm/versatile/versatile_clcd.c	Tue Jun 10 20:25:45 2014	(r267340)
@@ -363,8 +363,6 @@ versatile_clcdc_attach(device_t dev)
 fail:
 	if (sc->fb_base)
 		bus_dmamem_free(sc->dma_tag, sc->fb_base, sc->dma_map);
-	if (sc->dma_map)
-		bus_dmamap_destroy(sc->dma_tag, sc->dma_map);
 	if (sc->dma_tag)
 		bus_dma_tag_destroy(sc->dma_tag);
 	return (err);

Modified: head/sys/dev/advansys/adwcam.c
==============================================================================
--- head/sys/dev/advansys/adwcam.c	Tue Jun 10 19:00:14 2014	(r267339)
+++ head/sys/dev/advansys/adwcam.c	Tue Jun 10 20:25:45 2014	(r267340)
@@ -777,7 +777,6 @@ adw_free(struct adw_softc *adw)
 	case 7:
 		bus_dmamem_free(adw->acb_dmat, adw->acbs,
 				adw->acb_dmamap);
-		bus_dmamap_destroy(adw->acb_dmat, adw->acb_dmamap);
 	case 6:
 		bus_dma_tag_destroy(adw->acb_dmat);
 	case 5:
@@ -785,7 +784,6 @@ adw_free(struct adw_softc *adw)
 	case 4:
 		bus_dmamem_free(adw->carrier_dmat, adw->carriers,
 				adw->carrier_dmamap);
-		bus_dmamap_destroy(adw->carrier_dmat, adw->carrier_dmamap);
 	case 3:
 		bus_dma_tag_destroy(adw->carrier_dmat);
 	case 2:

Modified: head/sys/dev/an/if_an.c
==============================================================================
--- head/sys/dev/an/if_an.c	Tue Jun 10 19:00:14 2014	(r267339)
+++ head/sys/dev/an/if_an.c	Tue Jun 10 20:25:45 2014	(r267340)
@@ -483,10 +483,6 @@ an_dma_malloc(struct an_softc *sc, bus_s
 {
 	int r;
 
-	r = bus_dmamap_create(sc->an_dtag, BUS_DMA_NOWAIT, &dma->an_dma_map);
-	if (r != 0)
-		goto fail_0;
-
 	r = bus_dmamem_alloc(sc->an_dtag, (void**) &dma->an_dma_vaddr,
 			     BUS_DMA_NOWAIT, &dma->an_dma_map);
 	if (r != 0)
@@ -507,9 +503,6 @@ fail_2:
 	bus_dmamap_unload(sc->an_dtag, dma->an_dma_map);
 fail_1:
 	bus_dmamem_free(sc->an_dtag, dma->an_dma_vaddr, dma->an_dma_map);
-fail_0:
-	bus_dmamap_destroy(sc->an_dtag, dma->an_dma_map);
-	dma->an_dma_map = NULL;
 	return (r);
 }
 
@@ -519,7 +512,6 @@ an_dma_free(struct an_softc *sc, struct 
 	bus_dmamap_unload(sc->an_dtag, dma->an_dma_map);
 	bus_dmamem_free(sc->an_dtag, dma->an_dma_vaddr, dma->an_dma_map);
 	dma->an_dma_vaddr = 0;
-	bus_dmamap_destroy(sc->an_dtag, dma->an_dma_map);
 }
 
 /*

Modified: head/sys/dev/ata/ata-dma.c
==============================================================================
--- head/sys/dev/ata/ata-dma.c	Tue Jun 10 19:00:14 2014	(r267339)
+++ head/sys/dev/ata/ata-dma.c	Tue Jun 10 20:25:45 2014	(r267340)
@@ -224,11 +224,9 @@ ata_dmafree(device_t dev)
             bus_dmamap_unload(slot->sg_tag, slot->sg_map);
             slot->sg_bus = 0;
 	}
-	if (slot->sg_map) {
+	if (slot->sg) {
             bus_dmamem_free(slot->sg_tag, slot->sg, slot->sg_map);
-            bus_dmamap_destroy(slot->sg_tag, slot->sg_map);
             slot->sg = NULL;
-            slot->sg_map = NULL;
 	}
 	if (slot->data_map) {
             bus_dmamap_destroy(slot->data_tag, slot->data_map);

Modified: head/sys/dev/buslogic/bt.c
==============================================================================
--- head/sys/dev/buslogic/bt.c	Tue Jun 10 19:00:14 2014	(r267339)
+++ head/sys/dev/buslogic/bt.c	Tue Jun 10 20:25:45 2014	(r267340)
@@ -246,7 +246,6 @@ bt_free_softc(device_t dev)
 	case 6:
 		bus_dmamem_free(bt->ccb_dmat, bt->bt_ccb_array,
 				bt->ccb_dmamap);
-		bus_dmamap_destroy(bt->ccb_dmat, bt->ccb_dmamap);
 		/* FALLTHROUGH */
 	case 5:
 		bus_dma_tag_destroy(bt->ccb_dmat);
@@ -257,7 +256,6 @@ bt_free_softc(device_t dev)
 	case 3:
 		bus_dmamem_free(bt->mailbox_dmat, bt->in_boxes,
 				bt->mailbox_dmamap);
-		bus_dmamap_destroy(bt->mailbox_dmat, bt->mailbox_dmamap);
 		/* FALLTHROUGH */
 	case 2:
 		bus_dma_tag_destroy(bt->buffer_dmat);

Modified: head/sys/dev/dpt/dpt_scsi.c
==============================================================================
--- head/sys/dev/dpt/dpt_scsi.c	Tue Jun 10 19:00:14 2014	(r267339)
+++ head/sys/dev/dpt/dpt_scsi.c	Tue Jun 10 20:25:45 2014	(r267340)
@@ -1149,7 +1149,6 @@ dpt_free(struct dpt_softc *dpt)
 	case 4:
 		bus_dmamem_free(dpt->dccb_dmat, dpt->dpt_dccbs,
 				dpt->dccb_dmamap);
-		bus_dmamap_destroy(dpt->dccb_dmat, dpt->dccb_dmamap);
 	case 3:
 		bus_dma_tag_destroy(dpt->dccb_dmat);
 	case 2:

Modified: head/sys/dev/hifn/hifn7751.c
==============================================================================
--- head/sys/dev/hifn/hifn7751.c	Tue Jun 10 19:00:14 2014	(r267339)
+++ head/sys/dev/hifn/hifn7751.c	Tue Jun 10 20:25:45 2014	(r267340)
@@ -463,7 +463,6 @@ hifn_attach(device_t dev)
 			     BUS_DMA_NOWAIT)) {
 		device_printf(dev, "cannot load dma map\n");
 		bus_dmamem_free(sc->sc_dmat, kva, sc->sc_dmamap);
-		bus_dmamap_destroy(sc->sc_dmat, sc->sc_dmamap);
 		bus_dma_tag_destroy(sc->sc_dmat);
 		goto fail_io1;
 	}
@@ -603,7 +602,6 @@ fail_intr2:
 fail_mem:
 	bus_dmamap_unload(sc->sc_dmat, sc->sc_dmamap);
 	bus_dmamem_free(sc->sc_dmat, sc->sc_dma, sc->sc_dmamap);
-	bus_dmamap_destroy(sc->sc_dmat, sc->sc_dmamap);
 	bus_dma_tag_destroy(sc->sc_dmat);
 
 	/* Turn off DMA polling */
@@ -653,7 +651,6 @@ hifn_detach(device_t dev)
 
 	bus_dmamap_unload(sc->sc_dmat, sc->sc_dmamap);
 	bus_dmamem_free(sc->sc_dmat, sc->sc_dma, sc->sc_dmamap);
-	bus_dmamap_destroy(sc->sc_dmat, sc->sc_dmamap);
 	bus_dma_tag_destroy(sc->sc_dmat);
 
 	bus_release_resource(dev, SYS_RES_MEMORY, HIFN_BAR1, sc->sc_bar1res);

Modified: head/sys/dev/malo/if_malo.c
==============================================================================
--- head/sys/dev/malo/if_malo.c	Tue Jun 10 19:00:14 2014	(r267339)
+++ head/sys/dev/malo/if_malo.c	Tue Jun 10 20:25:45 2014	(r267340)
@@ -496,13 +496,6 @@ malo_desc_setup(struct malo_softc *sc, c
 	}
 	
 	/* allocate descriptors */
-	error = bus_dmamap_create(dd->dd_dmat, BUS_DMA_NOWAIT, &dd->dd_dmamap);
-	if (error != 0) {
-		if_printf(ifp, "unable to create dmamap for %s descriptors, "
-		    "error %u\n", dd->dd_name, error);
-		goto fail0;
-	}
-	
 	error = bus_dmamem_alloc(dd->dd_dmat, (void**) &dd->dd_desc,
 	    BUS_DMA_NOWAIT | BUS_DMA_COHERENT, &dd->dd_dmamap);
 	if (error != 0) {
@@ -530,8 +523,6 @@ malo_desc_setup(struct malo_softc *sc, c
 fail2:
 	bus_dmamem_free(dd->dd_dmat, dd->dd_desc, dd->dd_dmamap);
 fail1:
-	bus_dmamap_destroy(dd->dd_dmat, dd->dd_dmamap);
-fail0:
 	bus_dma_tag_destroy(dd->dd_dmat);
 	memset(dd, 0, sizeof(*dd));
 	return error;
@@ -632,7 +623,6 @@ malo_desc_cleanup(struct malo_softc *sc,
 {
 	bus_dmamap_unload(dd->dd_dmat, dd->dd_dmamap);
 	bus_dmamem_free(dd->dd_dmat, dd->dd_desc, dd->dd_dmamap);
-	bus_dmamap_destroy(dd->dd_dmat, dd->dd_dmamap);
 	bus_dma_tag_destroy(dd->dd_dmat);
 
 	memset(dd, 0, sizeof(*dd));

Modified: head/sys/dev/malo/if_malohal.c
==============================================================================
--- head/sys/dev/malo/if_malohal.c	Tue Jun 10 19:00:14 2014	(r267339)
+++ head/sys/dev/malo/if_malohal.c	Tue Jun 10 20:25:45 2014	(r267340)
@@ -137,13 +137,6 @@ malo_hal_attach(device_t dev, uint16_t d
 	}
 
 	/* allocate descriptors */
-	error = bus_dmamap_create(mh->mh_dmat, BUS_DMA_NOWAIT, &mh->mh_dmamap);
-	if (error != 0) {
-		device_printf(dev, "unable to create dmamap for cmd buffers, "
-			"error %u\n", error);
-		goto fail;
-	}
-
 	error = bus_dmamem_alloc(mh->mh_dmat, (void**) &mh->mh_cmdbuf,
 				 BUS_DMA_NOWAIT | BUS_DMA_COHERENT, 
 				 &mh->mh_dmamap);
@@ -166,13 +159,9 @@ malo_hal_attach(device_t dev, uint16_t d
 	return (mh);
 
 fail:
-	if (mh->mh_dmamap != NULL) {
-		bus_dmamap_unload(mh->mh_dmat, mh->mh_dmamap);
-		if (mh->mh_cmdbuf != NULL)
-			bus_dmamem_free(mh->mh_dmat, mh->mh_cmdbuf,
-			    mh->mh_dmamap);
-		bus_dmamap_destroy(mh->mh_dmat, mh->mh_dmamap);
-	}
+	if (mh->mh_cmdbuf != NULL)
+		bus_dmamem_free(mh->mh_dmat, mh->mh_cmdbuf,
+		    mh->mh_dmamap);
 	if (mh->mh_dmat)
 		bus_dma_tag_destroy(mh->mh_dmat);
 	free(mh, M_DEVBUF);
@@ -592,7 +581,6 @@ malo_hal_detach(struct malo_hal *mh)
 {
 
 	bus_dmamem_free(mh->mh_dmat, mh->mh_cmdbuf, mh->mh_dmamap);
-	bus_dmamap_destroy(mh->mh_dmat, mh->mh_dmamap);
 	bus_dma_tag_destroy(mh->mh_dmat);
 	mtx_destroy(&mh->mh_mtx);
 	free(mh, M_DEVBUF);

Modified: head/sys/dev/mwl/if_mwl.c
==============================================================================
--- head/sys/dev/mwl/if_mwl.c	Tue Jun 10 19:00:14 2014	(r267339)
+++ head/sys/dev/mwl/if_mwl.c	Tue Jun 10 20:25:45 2014	(r267340)
@@ -2041,13 +2041,6 @@ mwl_desc_setup(struct mwl_softc *sc, con
 	}
 
 	/* allocate descriptors */
-	error = bus_dmamap_create(dd->dd_dmat, BUS_DMA_NOWAIT, &dd->dd_dmamap);
-	if (error != 0) {
-		if_printf(ifp, "unable to create dmamap for %s descriptors, "
-			"error %u\n", dd->dd_name, error);
-		goto fail0;
-	}
-
 	error = bus_dmamem_alloc(dd->dd_dmat, (void**) &dd->dd_desc,
 				 BUS_DMA_NOWAIT | BUS_DMA_COHERENT, 
 				 &dd->dd_dmamap);
@@ -2077,8 +2070,6 @@ mwl_desc_setup(struct mwl_softc *sc, con
 fail2:
 	bus_dmamem_free(dd->dd_dmat, dd->dd_desc, dd->dd_dmamap);
 fail1:
-	bus_dmamap_destroy(dd->dd_dmat, dd->dd_dmamap);
-fail0:
 	bus_dma_tag_destroy(dd->dd_dmat);
 	memset(dd, 0, sizeof(*dd));
 	return error;
@@ -2090,7 +2081,6 @@ mwl_desc_cleanup(struct mwl_softc *sc, s
 {
 	bus_dmamap_unload(dd->dd_dmat, dd->dd_dmamap);
 	bus_dmamem_free(dd->dd_dmat, dd->dd_desc, dd->dd_dmamap);
-	bus_dmamap_destroy(dd->dd_dmat, dd->dd_dmamap);
 	bus_dma_tag_destroy(dd->dd_dmat);
 
 	memset(dd, 0, sizeof(*dd));
@@ -2229,9 +2219,8 @@ mwl_rxdma_setup(struct mwl_softc *sc)
 		       NULL,			/* lockfunc */
 		       NULL,			/* lockarg */
 		       &sc->sc_rxdmat);
-	error = bus_dmamap_create(sc->sc_rxdmat, BUS_DMA_NOWAIT, &sc->sc_rxmap);
 	if (error != 0) {
-		if_printf(ifp, "could not create rx DMA map\n");
+		if_printf(ifp, "could not create rx DMA tag\n");
 		return error;
 	}
 
@@ -2292,16 +2281,14 @@ mwl_rxdma_setup(struct mwl_softc *sc)
 static void
 mwl_rxdma_cleanup(struct mwl_softc *sc)
 {
-	if (sc->sc_rxmap != NULL)
+	if (sc->sc_rxmem_paddr != 0) {
 		bus_dmamap_unload(sc->sc_rxdmat, sc->sc_rxmap);
+		sc->sc_rxmem_paddr = 0;
+	}
 	if (sc->sc_rxmem != NULL) {
 		bus_dmamem_free(sc->sc_rxdmat, sc->sc_rxmem, sc->sc_rxmap);
 		sc->sc_rxmem = NULL;
 	}
-	if (sc->sc_rxmap != NULL) {
-		bus_dmamap_destroy(sc->sc_rxdmat, sc->sc_rxmap);
-		sc->sc_rxmap = NULL;
-	}
 	if (sc->sc_rxdma.dd_bufptr != NULL) {
 		free(sc->sc_rxdma.dd_bufptr, M_MWLDEV);
 		sc->sc_rxdma.dd_bufptr = NULL;

Modified: head/sys/dev/mwl/mwlhal.c
==============================================================================
--- head/sys/dev/mwl/mwlhal.c	Tue Jun 10 19:00:14 2014	(r267339)
+++ head/sys/dev/mwl/mwlhal.c	Tue Jun 10 20:25:45 2014	(r267340)
@@ -309,19 +309,12 @@ mwl_hal_attach(device_t dev, uint16_t de
 		       NULL,			/* lockarg */
 		       &mh->mh_dmat);
 	if (error != 0) {
-		device_printf(dev, "unable to allocate memory for cmd buffer, "
+		device_printf(dev, "unable to allocate memory for cmd tag, "
 			"error %u\n", error);
 		goto fail0;
 	}
 
 	/* allocate descriptors */
-	error = bus_dmamap_create(mh->mh_dmat, BUS_DMA_NOWAIT, &mh->mh_dmamap);
-	if (error != 0) {
-		device_printf(dev, "unable to create dmamap for cmd buffers, "
-			"error %u\n", error);
-		goto fail0;
-	}
-
 	error = bus_dmamem_alloc(mh->mh_dmat, (void**) &mh->mh_cmdbuf,
 				 BUS_DMA_NOWAIT | BUS_DMA_COHERENT, 
 				 &mh->mh_dmamap);
@@ -365,9 +358,8 @@ mwl_hal_attach(device_t dev, uint16_t de
 fail2:
 	bus_dmamem_free(mh->mh_dmat, mh->mh_cmdbuf, mh->mh_dmamap);
 fail1:
-	bus_dmamap_destroy(mh->mh_dmat, mh->mh_dmamap);
-fail0:
 	bus_dma_tag_destroy(mh->mh_dmat);
+fail0:
 	mtx_destroy(&mh->mh_mtx);
 	free(mh, M_DEVBUF);
 	return NULL;
@@ -379,7 +371,6 @@ mwl_hal_detach(struct mwl_hal *mh0)
 	struct mwl_hal_priv *mh = MWLPRIV(mh0);
 
 	bus_dmamem_free(mh->mh_dmat, mh->mh_cmdbuf, mh->mh_dmamap);
-	bus_dmamap_destroy(mh->mh_dmat, mh->mh_dmamap);
 	bus_dma_tag_destroy(mh->mh_dmat);
 	mtx_destroy(&mh->mh_mtx);
 	free(mh, M_DEVBUF);

Modified: head/sys/dev/safe/safe.c
==============================================================================
--- head/sys/dev/safe/safe.c	Tue Jun 10 19:00:14 2014	(r267339)
+++ head/sys/dev/safe/safe.c	Tue Jun 10 20:25:45 2014	(r267340)
@@ -1807,20 +1807,13 @@ safe_dma_malloc(
 		goto fail_0;
 	}
 
-	r = bus_dmamap_create(dma->dma_tag, BUS_DMA_NOWAIT, &dma->dma_map);
-	if (r != 0) {
-		device_printf(sc->sc_dev, "safe_dma_malloc: "
-			"bus_dmamap_create failed; error %u\n", r);
-		goto fail_1;
-	}
-
 	r = bus_dmamem_alloc(dma->dma_tag, (void**) &dma->dma_vaddr,
 			     BUS_DMA_NOWAIT, &dma->dma_map);
 	if (r != 0) {
 		device_printf(sc->sc_dev, "safe_dma_malloc: "
 			"bus_dmammem_alloc failed; size %zu, error %u\n",
 			size, r);
-		goto fail_2;
+		goto fail_1;
 	}
 
 	r = bus_dmamap_load(dma->dma_tag, dma->dma_map, dma->dma_vaddr,
@@ -1831,21 +1824,18 @@ safe_dma_malloc(
 	if (r != 0) {
 		device_printf(sc->sc_dev, "safe_dma_malloc: "
 			"bus_dmamap_load failed; error %u\n", r);
-		goto fail_3;
+		goto fail_2;
 	}
 
 	dma->dma_size = size;
 	return (0);
 
-fail_3:
 	bus_dmamap_unload(dma->dma_tag, dma->dma_map);
 fail_2:
 	bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map);
 fail_1:
-	bus_dmamap_destroy(dma->dma_tag, dma->dma_map);
 	bus_dma_tag_destroy(dma->dma_tag);
 fail_0:
-	dma->dma_map = NULL;
 	dma->dma_tag = NULL;
 	return (r);
 }
@@ -1855,7 +1845,6 @@ safe_dma_free(struct safe_softc *sc, str
 {
 	bus_dmamap_unload(dma->dma_tag, dma->dma_map);
 	bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map);
-	bus_dmamap_destroy(dma->dma_tag, dma->dma_map);
 	bus_dma_tag_destroy(dma->dma_tag);
 }
 

Modified: head/sys/dev/sym/sym_hipd.c
==============================================================================
--- head/sys/dev/sym/sym_hipd.c	Tue Jun 10 19:00:14 2014	(r267339)
+++ head/sys/dev/sym/sym_hipd.c	Tue Jun 10 20:25:45 2014	(r267340)
@@ -617,11 +617,8 @@ out_err:
 		bus_dmamap_unload(mp->dmat, vbp->dmamap);
 	if (vaddr)
 		bus_dmamem_free(mp->dmat, vaddr, vbp->dmamap);
-	if (vbp) {
-		if (vbp->dmamap)
-			bus_dmamap_destroy(mp->dmat, vbp->dmamap);
+	if (vbp)
 		__sym_mfree(&mp0, vbp, sizeof(*vbp), "VTOB");
-	}
 	return 0;
 }
 
@@ -639,7 +636,6 @@ static void ___dma_freep(m_pool_s *mp, m
 		*vbpp = (*vbpp)->next;
 		bus_dmamap_unload(mp->dmat, vbp->dmamap);
 		bus_dmamem_free(mp->dmat, (void *) vbp->vaddr, vbp->dmamap);
-		bus_dmamap_destroy(mp->dmat, vbp->dmamap);
 		__sym_mfree(&mp0, vbp, sizeof(*vbp), "VTOB");
 		--mp->nump;
 	}

Modified: head/sys/dev/trm/trm.c
==============================================================================
--- head/sys/dev/trm/trm.c	Tue Jun 10 19:00:14 2014	(r267339)
+++ head/sys/dev/trm/trm.c	Tue Jun 10 20:25:45 2014	(r267340)
@@ -2944,12 +2944,11 @@ trm_destroySRB(PACB pACB)
 
 	pSRB = pACB->pFreeSRB;
 	while (pSRB) {
-		if (pSRB->sg_dmamap) {
+		if (pSRB->SRBSGPhyAddr)
 			bus_dmamap_unload(pACB->sg_dmat, pSRB->sg_dmamap);
+		if (pSRB->pSRBSGL)
 			bus_dmamem_free(pACB->sg_dmat, pSRB->pSRBSGL,
 			    pSRB->sg_dmamap);
-			bus_dmamap_destroy(pACB->sg_dmat, pSRB->sg_dmamap);
-		}
 		if (pSRB->dmamap)
 			bus_dmamap_destroy(pACB->buffer_dmat, pSRB->dmamap);
 		pSRB = pSRB->pNextSRB;
@@ -3494,7 +3493,6 @@ bad:
 		bus_dmamap_unload(pACB->sense_dmat, pACB->sense_dmamap);
 		bus_dmamem_free(pACB->sense_dmat, pACB->sense_buffers,
 		    pACB->sense_dmamap);
-		bus_dmamap_destroy(pACB->sense_dmat, pACB->sense_dmamap);
 	}
 	if (pACB->sense_dmat)
 		bus_dma_tag_destroy(pACB->sense_dmat);
@@ -3502,11 +3500,10 @@ bad:
 		trm_destroySRB(pACB);
 		bus_dma_tag_destroy(pACB->sg_dmat);
 	}
-	if (pACB->srb_dmamap) {
+	if (pACB->pFreeSRB) {
 		bus_dmamap_unload(pACB->srb_dmat, pACB->srb_dmamap);
 		bus_dmamem_free(pACB->srb_dmat, pACB->pFreeSRB, 
 		    pACB->srb_dmamap);
-		bus_dmamap_destroy(pACB->srb_dmat, pACB->srb_dmamap);
 	}
 	if (pACB->srb_dmat)
 		bus_dma_tag_destroy(pACB->srb_dmat);
@@ -3618,19 +3615,17 @@ bad:
 		bus_dma_tag_destroy(pACB->sg_dmat);
 	}
 	
-	if (pACB->srb_dmamap) {
+	if (pACB->pFreeSRB) {
 		bus_dmamap_unload(pACB->srb_dmat, pACB->srb_dmamap);
 		bus_dmamem_free(pACB->srb_dmat, pACB->pFreeSRB, 
 		    pACB->srb_dmamap);
-		bus_dmamap_destroy(pACB->srb_dmat, pACB->srb_dmamap);
 	}
 	if (pACB->srb_dmat)
 		bus_dma_tag_destroy(pACB->srb_dmat);
-	if (pACB->sense_dmamap) {
+	if (pACB->sense_buffers) {
 	  	  bus_dmamap_unload(pACB->sense_dmat, pACB->sense_dmamap);
 		  bus_dmamem_free(pACB->sense_dmat, pACB->sense_buffers,
 		      pACB->sense_dmamap);
-		  bus_dmamap_destroy(pACB->sense_dmat, pACB->sense_dmamap);
 	}
 	if (pACB->sense_dmat)
 		bus_dma_tag_destroy(pACB->sense_dmat);		
@@ -3680,12 +3675,10 @@ trm_detach(device_t dev)
 	bus_dmamap_unload(pACB->srb_dmat, pACB->srb_dmamap);
 	bus_dmamem_free(pACB->srb_dmat, pACB->pFreeSRB,
 	    pACB->srb_dmamap);
-	bus_dmamap_destroy(pACB->srb_dmat, pACB->srb_dmamap);
 	bus_dma_tag_destroy(pACB->srb_dmat);	
 	bus_dmamap_unload(pACB->sense_dmat, pACB->sense_dmamap);
 	bus_dmamem_free(pACB->sense_dmat, pACB->sense_buffers,
 	    pACB->sense_dmamap);
-	bus_dmamap_destroy(pACB->sense_dmat, pACB->sense_dmamap);
 	bus_dma_tag_destroy(pACB->sense_dmat);				      
 	bus_dma_tag_destroy(pACB->buffer_dmat);
 	bus_teardown_intr(dev, pACB->irq, pACB->ih);

Modified: head/sys/dev/tx/if_tx.c
==============================================================================
--- head/sys/dev/tx/if_tx.c	Tue Jun 10 19:00:14 2014	(r267339)
+++ head/sys/dev/tx/if_tx.c	Tue Jun 10 20:25:45 2014	(r267340)
@@ -447,17 +447,14 @@ epic_release(epic_softc_t *sc)
 	if (sc->tx_flist) {
 		bus_dmamap_unload(sc->ftag, sc->fmap);
 		bus_dmamem_free(sc->ftag, sc->tx_flist, sc->fmap);
-		bus_dmamap_destroy(sc->ftag, sc->fmap);
 	}
 	if (sc->tx_desc) {
 		bus_dmamap_unload(sc->ttag, sc->tmap);
 		bus_dmamem_free(sc->ttag, sc->tx_desc, sc->tmap);
-		bus_dmamap_destroy(sc->ttag, sc->tmap);
 	}
 	if (sc->rx_desc) {
 		bus_dmamap_unload(sc->rtag, sc->rmap);
 		bus_dmamem_free(sc->rtag, sc->rx_desc, sc->rmap);
-		bus_dmamap_destroy(sc->rtag, sc->rmap);
 	}
 	if (sc->mtag)
 		bus_dma_tag_destroy(sc->mtag);

Modified: head/sys/dev/ubsec/ubsec.c
==============================================================================
--- head/sys/dev/ubsec/ubsec.c	Tue Jun 10 19:00:14 2014	(r267339)
+++ head/sys/dev/ubsec/ubsec.c	Tue Jun 10 20:25:45 2014	(r267340)
@@ -1856,13 +1856,6 @@ ubsec_dma_malloc(
 	if (r != 0) {
 		device_printf(sc->sc_dev, "ubsec_dma_malloc: "
 			"bus_dma_tag_create failed; error %u\n", r);
-		goto fail_0;
-	}
-
-	r = bus_dmamap_create(dma->dma_tag, BUS_DMA_NOWAIT, &dma->dma_map);
-	if (r != 0) {
-		device_printf(sc->sc_dev, "ubsec_dma_malloc: "
-			"bus_dmamap_create failed; error %u\n", r);
 		goto fail_1;
 	}
 
@@ -1894,10 +1887,7 @@ fail_3:
 fail_2:
 	bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map);
 fail_1:
-	bus_dmamap_destroy(dma->dma_tag, dma->dma_map);
 	bus_dma_tag_destroy(dma->dma_tag);
-fail_0:
-	dma->dma_map = NULL;
 	dma->dma_tag = NULL;
 	return (r);
 }
@@ -1907,7 +1897,6 @@ ubsec_dma_free(struct ubsec_softc *sc, s
 {
 	bus_dmamap_unload(dma->dma_tag, dma->dma_map);
 	bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map);
-	bus_dmamap_destroy(dma->dma_tag, dma->dma_map);
 	bus_dma_tag_destroy(dma->dma_tag);
 }
 



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