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
This commit is contained in:
Alexander Kabaev 2014-06-23 03:45:39 +00:00
parent efa1aff675
commit 8cf27a3330

View File

@ -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);
}