From owner-svn-src-head@FreeBSD.ORG Tue Jul 1 18:24:55 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3E9DA48F; Tue, 1 Jul 2014 18:24:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2CD8B2F52; Tue, 1 Jul 2014 18:24:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s61IOt3Z022118; Tue, 1 Jul 2014 18:24:55 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s61IOtdq022117; Tue, 1 Jul 2014 18:24:55 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201407011824.s61IOtdq022117@svn.freebsd.org> From: John Baldwin Date: Tue, 1 Jul 2014 18:24:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r268109 - head/sys/dev/tws X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jul 2014 18:24:55 -0000 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;iirqs;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,