diff options
author | yongari <yongari@FreeBSD.org> | 2011-01-13 23:00:28 +0000 |
---|---|---|
committer | yongari <yongari@FreeBSD.org> | 2011-01-13 23:00:28 +0000 |
commit | b6c0fa3763880da9adcda19eabdbc84512583103 (patch) | |
tree | d0c0e7f190ba7e7b47537698f976e0f61eb5a8a8 /sys | |
parent | 435503f326f7e1169f0fe66c3833ede6afef73fc (diff) | |
download | FreeBSD-src-b6c0fa3763880da9adcda19eabdbc84512583103.zip FreeBSD-src-b6c0fa3763880da9adcda19eabdbc84512583103.tar.gz |
Make sure to check validity of dma maps before destroying.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/re/if_re.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c index f9c72b0..92db00a 100644 --- a/sys/dev/re/if_re.c +++ b/sys/dev/re/if_re.c @@ -1663,15 +1663,19 @@ re_detach(device_t dev) /* Destroy all the RX and TX buffer maps */ if (sc->rl_ldata.rl_tx_mtag) { - for (i = 0; i < sc->rl_ldata.rl_tx_desc_cnt; i++) - bus_dmamap_destroy(sc->rl_ldata.rl_tx_mtag, - sc->rl_ldata.rl_tx_desc[i].tx_dmamap); + for (i = 0; i < sc->rl_ldata.rl_tx_desc_cnt; i++) { + if (sc->rl_ldata.rl_tx_desc[i].tx_dmamap) + bus_dmamap_destroy(sc->rl_ldata.rl_tx_mtag, + sc->rl_ldata.rl_tx_desc[i].tx_dmamap); + } bus_dma_tag_destroy(sc->rl_ldata.rl_tx_mtag); } if (sc->rl_ldata.rl_rx_mtag) { - for (i = 0; i < sc->rl_ldata.rl_rx_desc_cnt; i++) - bus_dmamap_destroy(sc->rl_ldata.rl_rx_mtag, - sc->rl_ldata.rl_rx_desc[i].rx_dmamap); + for (i = 0; i < sc->rl_ldata.rl_rx_desc_cnt; i++) { + if (sc->rl_ldata.rl_rx_desc[i].rx_dmamap) + bus_dmamap_destroy(sc->rl_ldata.rl_rx_mtag, + sc->rl_ldata.rl_rx_desc[i].rx_dmamap); + } if (sc->rl_ldata.rl_rx_sparemap) bus_dmamap_destroy(sc->rl_ldata.rl_rx_mtag, sc->rl_ldata.rl_rx_sparemap); |