Author: kan
Date: Mon Jun 23 03:45:39 2014
New Revision: 267762
URL: http://svnweb.freebsd.org/changeset/base/267762

Log:
  Restore the check for non-NULL dmatag in sndbuf_free.
  
  The sound drivers that use own buffer management can use sndbuf_setup
  and not do any busdma allocation, so the driver will end up with the
  managed buffer but no valid dma map and tag for it. Avoid calling
  bus_dmamem_free in such cases.
  
  Reported by: ache
  Missed in review by: kan

Modified:
  head/sys/dev/sound/pcm/buffer.c

Modified: head/sys/dev/sound/pcm/buffer.c
==============================================================================
--- head/sys/dev/sound/pcm/buffer.c     Mon Jun 23 02:00:14 2014        
(r267761)
+++ head/sys/dev/sound/pcm/buffer.c     Mon Jun 23 03:45:39 2014        
(r267762)
@@ -141,7 +141,8 @@ sndbuf_free(struct snd_dbuf *b)
                if (b->flags & SNDBUF_F_MANAGED) {
                        if (b->buf_addr)
                                bus_dmamap_unload(b->dmatag, b->dmamap);
-                       bus_dmamem_free(b->dmatag, b->buf, b->dmamap);
+                       if (b->dmatag)
+                               bus_dmamem_free(b->dmatag, b->buf, b->dmamap);
                } else
                        free(b->buf, M_DEVBUF);
        }
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to