From 8cf27a33301b714dd51e28ea8e5e928636d08966 Mon Sep 17 00:00:00 2001 From: Alexander Kabaev Date: Mon, 23 Jun 2014 03:45:39 +0000 Subject: [PATCH] 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 --- sys/dev/sound/pcm/buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/sound/pcm/buffer.c b/sys/dev/sound/pcm/buffer.c index 4de689974636..a925fb160036 100644 --- a/sys/dev/sound/pcm/buffer.c +++ b/sys/dev/sound/pcm/buffer.c @@ -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); }