summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiorgos Keramidas <keramida@FreeBSD.org>2005-09-15 17:51:39 +0000
committerGiorgos Keramidas <keramida@FreeBSD.org>2005-09-15 17:51:39 +0000
commit4f867c2d17b63d39cc83772e64e2809106436b97 (patch)
treed9b12d00129e98306e85a2984d1fd86900e284a4
parentf726a8731939a995a5718727a000f885f84314f9 (diff)
Notes
-rw-r--r--sys/dev/dc/if_dc.c16
-rw-r--r--sys/pci/if_dc.c16
2 files changed, 22 insertions, 10 deletions
diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c
index 34a80128564a..1dab3748797f 100644
--- a/sys/dev/dc/if_dc.c
+++ b/sys/dev/dc/if_dc.c
@@ -2364,11 +2364,17 @@ dc_detach(device_t dev)
bus_dmamem_free(sc->dc_stag, sc->dc_cdata.dc_sbuf, sc->dc_smap);
if (sc->dc_ldata != NULL)
bus_dmamem_free(sc->dc_ltag, sc->dc_ldata, sc->dc_lmap);
- for (i = 0; i < DC_TX_LIST_CNT; i++)
- bus_dmamap_destroy(sc->dc_mtag, sc->dc_cdata.dc_tx_map[i]);
- for (i = 0; i < DC_RX_LIST_CNT; i++)
- bus_dmamap_destroy(sc->dc_mtag, sc->dc_cdata.dc_rx_map[i]);
- bus_dmamap_destroy(sc->dc_mtag, sc->dc_sparemap);
+ if (sc->dc_mtag) {
+ for (i = 0; i < DC_TX_LIST_CNT; i++)
+ if (sc->dc_cdata.dc_tx_map[i] != NULL)
+ bus_dmamap_destroy(sc->dc_mtag,
+ sc->dc_cdata.dc_tx_map[i]);
+ for (i = 0; i < DC_RX_LIST_CNT; i++)
+ if (sc->dc_cdata.dc_rx_map[i] != NULL)
+ bus_dmamap_destroy(sc->dc_mtag,
+ sc->dc_cdata.dc_rx_map[i]);
+ bus_dmamap_destroy(sc->dc_mtag, sc->dc_sparemap);
+ }
if (sc->dc_stag)
bus_dma_tag_destroy(sc->dc_stag);
if (sc->dc_mtag)
diff --git a/sys/pci/if_dc.c b/sys/pci/if_dc.c
index 34a80128564a..1dab3748797f 100644
--- a/sys/pci/if_dc.c
+++ b/sys/pci/if_dc.c
@@ -2364,11 +2364,17 @@ dc_detach(device_t dev)
bus_dmamem_free(sc->dc_stag, sc->dc_cdata.dc_sbuf, sc->dc_smap);
if (sc->dc_ldata != NULL)
bus_dmamem_free(sc->dc_ltag, sc->dc_ldata, sc->dc_lmap);
- for (i = 0; i < DC_TX_LIST_CNT; i++)
- bus_dmamap_destroy(sc->dc_mtag, sc->dc_cdata.dc_tx_map[i]);
- for (i = 0; i < DC_RX_LIST_CNT; i++)
- bus_dmamap_destroy(sc->dc_mtag, sc->dc_cdata.dc_rx_map[i]);
- bus_dmamap_destroy(sc->dc_mtag, sc->dc_sparemap);
+ if (sc->dc_mtag) {
+ for (i = 0; i < DC_TX_LIST_CNT; i++)
+ if (sc->dc_cdata.dc_tx_map[i] != NULL)
+ bus_dmamap_destroy(sc->dc_mtag,
+ sc->dc_cdata.dc_tx_map[i]);
+ for (i = 0; i < DC_RX_LIST_CNT; i++)
+ if (sc->dc_cdata.dc_rx_map[i] != NULL)
+ bus_dmamap_destroy(sc->dc_mtag,
+ sc->dc_cdata.dc_rx_map[i]);
+ bus_dmamap_destroy(sc->dc_mtag, sc->dc_sparemap);
+ }
if (sc->dc_stag)
bus_dma_tag_destroy(sc->dc_stag);
if (sc->dc_mtag)