Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Jul 2014 18:24:55 +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: r268109 - head/sys/dev/tws
Message-ID:  <201407011824.s61IOtdq022117@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Tue Jul  1 18:24:54 2014
New Revision: 268109
URL: http://svnweb.freebsd.org/changeset/base/268109

Log:
  Free the static DMA buffer holding the command ring during detach as well
  as if attach fails.

Modified:
  head/sys/dev/tws/tws.c

Modified: head/sys/dev/tws/tws.c
==============================================================================
--- head/sys/dev/tws/tws.c	Tue Jul  1 18:23:00 2014	(r268108)
+++ head/sys/dev/tws/tws.c	Tue Jul  1 18:24:54 2014	(r268109)
@@ -310,6 +310,12 @@ tws_attach(device_t dev)
 attach_fail_4:
     tws_teardown_intr(sc);
     destroy_dev(sc->tws_cdev);
+    if (sc->dma_mem_phys)
+	    bus_dmamap_unload(sc->cmd_tag, sc->cmd_map);
+    if (sc->dma_mem)
+	    bus_dmamem_free(sc->cmd_tag, sc->dma_mem, sc->cmd_map);
+    if (sc->cmd_tag)
+	    bus_dma_tag_destroy(sc->cmd_tag);
 attach_fail_3:
     for(i=0;i<sc->irqs;i++) {
         if ( sc->irq_res[i] ){
@@ -383,6 +389,13 @@ tws_detach(device_t dev)
 
     tws_cam_detach(sc);
 
+    if (sc->dma_mem_phys)
+	    bus_dmamap_unload(sc->cmd_tag, sc->cmd_map);
+    if (sc->dma_mem)
+	    bus_dmamem_free(sc->cmd_tag, sc->dma_mem, sc->cmd_map);
+    if (sc->cmd_tag)
+	    bus_dma_tag_destroy(sc->cmd_tag);
+
     /* Release memory resource */
     if ( sc->mfa_res ){
         if (bus_release_resource(sc->tws_dev,



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