svn commit: r268109 - head/sys/dev/tws

John Baldwin jhb at FreeBSD.org
Tue Jul 1 18:24:55 UTC 2014


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,


More information about the svn-src-head mailing list