1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-25 11:37:56 +00:00

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
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=267762

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