Fix various NIC drivers to properly cleanup static DMA resources.

In particular, don't check the value of the bus_dma map against NULL
to determine if either bus_dmamem_alloc() or bus_dmamap_load() succeeded.
Instead, assume that bus_dmamap_load() succeeeded (and thus that
bus_dmamap_unload() should be called) if the bus address for a resource
is non-zero, and assume that bus_dmamem_alloc() succeeded (and thus
that bus_dmamem_free() should be called) if the virtual address for a
resource is not NULL.

In many cases these bugs could result in leaks when a driver was detached.

Reviewed by:	yongari
MFC after:	2 weeks
This commit is contained in:
John Baldwin 2014-06-11 14:53:58 +00:00
parent 4f655310bf
commit 068d8643ad
25 changed files with 222 additions and 266 deletions

View File

@ -258,14 +258,14 @@ macb_free_desc_dma_tx(struct macb_softc *sc)
/* TX descriptor ring. */ /* TX descriptor ring. */
if (sc->dmatag_data_tx != NULL) { if (sc->dmatag_data_tx != NULL) {
if (sc->dmamap_ring_tx != NULL) if (sc->ring_paddr_tx != 0)
bus_dmamap_unload(sc->dmatag_data_tx, bus_dmamap_unload(sc->dmatag_data_tx,
sc->dmamap_ring_tx); sc->dmamap_ring_tx);
if (sc->dmamap_ring_tx != NULL && sc->desc_tx != NULL) if (sc->desc_tx != NULL)
bus_dmamem_free(sc->dmatag_data_tx, sc->desc_tx, bus_dmamem_free(sc->dmatag_data_tx, sc->desc_tx,
sc->dmamap_ring_tx); sc->dmamap_ring_tx);
sc->dmamap_ring_tx = NULL; sc->ring_paddr_tx = 0;
sc->dmamap_ring_tx = NULL; sc->desc_tx = NULL;
bus_dma_tag_destroy(sc->dmatag_data_tx); bus_dma_tag_destroy(sc->dmatag_data_tx);
sc->dmatag_data_tx = NULL; sc->dmatag_data_tx = NULL;
} }
@ -389,15 +389,14 @@ macb_free_desc_dma_rx(struct macb_softc *sc)
} }
/* RX descriptor ring. */ /* RX descriptor ring. */
if (sc->dmatag_data_rx != NULL) { if (sc->dmatag_data_rx != NULL) {
if (sc->dmamap_ring_rx != NULL) if (sc->ring_paddr_rx != 0)
bus_dmamap_unload(sc->dmatag_data_rx, bus_dmamap_unload(sc->dmatag_data_rx,
sc->dmamap_ring_rx); sc->dmamap_ring_rx);
if (sc->dmamap_ring_rx != NULL && if (sc->desc_rx != NULL)
sc->desc_rx != NULL)
bus_dmamem_free(sc->dmatag_data_rx, sc->desc_rx, bus_dmamem_free(sc->dmatag_data_rx, sc->desc_rx,
sc->dmamap_ring_rx); sc->dmamap_ring_rx);
sc->ring_paddr_rx = 0;
sc->desc_rx = NULL; sc->desc_rx = NULL;
sc->dmamap_ring_rx = NULL;
bus_dma_tag_destroy(sc->dmatag_data_rx); bus_dma_tag_destroy(sc->dmatag_data_rx);
sc->dmatag_data_rx = NULL; sc->dmatag_data_rx = NULL;
} }

View File

@ -565,13 +565,15 @@ ece_free_desc_dma_tx(struct ece_softc *sc)
} }
} }
if (sc->dmamap_ring_tx) { if (sc->ring_paddr_tx) {
bus_dmamap_unload(sc->dmatag_data_tx, sc->dmamap_ring_tx); bus_dmamap_unload(sc->dmatag_data_tx, sc->dmamap_ring_tx);
if (sc->desc_tx) { sc->ring_paddr_tx = 0;
bus_dmamem_free(sc->dmatag_data_tx, }
sc->desc_tx, sc->dmamap_ring_tx);
} if (sc->desc_tx) {
sc->dmamap_ring_tx = 0; bus_dmamem_free(sc->dmatag_data_tx,
sc->desc_tx, sc->dmamap_ring_tx);
sc->desc_tx = NULL;
} }
if (sc->dmatag_data_tx) { if (sc->dmatag_data_tx) {
@ -679,18 +681,24 @@ ece_free_desc_dma_rx(struct ece_softc *sc)
for (i = 0; i < ECE_MAX_RX_BUFFERS; i++) { for (i = 0; i < ECE_MAX_RX_BUFFERS; i++) {
if (sc->rx_desc[i].buff) { if (sc->rx_desc[i].buff) {
m_freem(sc->rx_desc[i].buff); m_freem(sc->rx_desc[i].buff);
sc->rx_desc[i].buff= 0; sc->rx_desc[i].buff = NULL;
} }
} }
if (sc->dmatag_data_rx) { if (sc->ring_paddr_rx) {
bus_dmamap_unload(sc->dmatag_data_rx, sc->dmamap_ring_rx); bus_dmamap_unload(sc->dmatag_data_rx, sc->dmamap_ring_rx);
sc->ring_paddr_rx = 0;
}
if (sc->desc_rx) {
bus_dmamem_free(sc->dmatag_data_rx, sc->desc_rx, bus_dmamem_free(sc->dmatag_data_rx, sc->desc_rx,
sc->dmamap_ring_rx); sc->dmamap_ring_rx);
sc->desc_rx = NULL;
}
if (sc->dmatag_data_rx) {
bus_dma_tag_destroy(sc->dmatag_data_rx); bus_dma_tag_destroy(sc->dmatag_data_rx);
sc->dmatag_data_rx = 0; sc->dmatag_data_rx = NULL;
sc->dmamap_ring_rx = 0;
sc->desc_rx = 0;
} }
if (sc->dmatag_ring_rx) { if (sc->dmatag_ring_rx) {
@ -699,7 +707,7 @@ ece_free_desc_dma_rx(struct ece_softc *sc)
sc->rx_desc[i].dmamap); sc->rx_desc[i].dmamap);
bus_dmamap_destroy(sc->dmatag_ring_rx, sc->rx_sparemap); bus_dmamap_destroy(sc->dmatag_ring_rx, sc->rx_sparemap);
bus_dma_tag_destroy(sc->dmatag_ring_rx); bus_dma_tag_destroy(sc->dmatag_ring_rx);
sc->dmatag_ring_rx = 0; sc->dmatag_ring_rx = NULL;
} }
} }

View File

@ -1226,43 +1226,37 @@ ae_dma_free(ae_softc_t *sc)
{ {
if (sc->dma_txd_tag != NULL) { if (sc->dma_txd_tag != NULL) {
if (sc->dma_txd_map != NULL) { if (sc->dma_txd_busaddr != 0)
bus_dmamap_unload(sc->dma_txd_tag, sc->dma_txd_map); bus_dmamap_unload(sc->dma_txd_tag, sc->dma_txd_map);
if (sc->txd_base != NULL) if (sc->txd_base != NULL)
bus_dmamem_free(sc->dma_txd_tag, sc->txd_base, bus_dmamem_free(sc->dma_txd_tag, sc->txd_base,
sc->dma_txd_map); sc->dma_txd_map);
}
bus_dma_tag_destroy(sc->dma_txd_tag); bus_dma_tag_destroy(sc->dma_txd_tag);
sc->dma_txd_map = NULL;
sc->dma_txd_tag = NULL; sc->dma_txd_tag = NULL;
sc->txd_base = NULL; sc->txd_base = NULL;
sc->dma_txd_busaddr = 0;
} }
if (sc->dma_txs_tag != NULL) { if (sc->dma_txs_tag != NULL) {
if (sc->dma_txs_map != NULL) { if (sc->dma_txs_busaddr != 0)
bus_dmamap_unload(sc->dma_txs_tag, sc->dma_txs_map); bus_dmamap_unload(sc->dma_txs_tag, sc->dma_txs_map);
if (sc->txs_base != NULL) if (sc->txs_base != NULL)
bus_dmamem_free(sc->dma_txs_tag, sc->txs_base, bus_dmamem_free(sc->dma_txs_tag, sc->txs_base,
sc->dma_txs_map); sc->dma_txs_map);
}
bus_dma_tag_destroy(sc->dma_txs_tag); bus_dma_tag_destroy(sc->dma_txs_tag);
sc->dma_txs_map = NULL;
sc->dma_txs_tag = NULL; sc->dma_txs_tag = NULL;
sc->txs_base = NULL; sc->txs_base = NULL;
sc->dma_txs_busaddr = 0;
} }
if (sc->dma_rxd_tag != NULL) { if (sc->dma_rxd_tag != NULL) {
if (sc->dma_rxd_map != NULL) { if (sc->dma_rxd_busaddr != 0)
bus_dmamap_unload(sc->dma_rxd_tag, sc->dma_rxd_map); bus_dmamap_unload(sc->dma_rxd_tag, sc->dma_rxd_map);
if (sc->rxd_base_dma != NULL) if (sc->rxd_base_dma != NULL)
bus_dmamem_free(sc->dma_rxd_tag, bus_dmamem_free(sc->dma_rxd_tag, sc->rxd_base_dma,
sc->rxd_base_dma, sc->dma_rxd_map); sc->dma_rxd_map);
}
bus_dma_tag_destroy(sc->dma_rxd_tag); bus_dma_tag_destroy(sc->dma_rxd_tag);
sc->dma_rxd_map = NULL;
sc->dma_rxd_tag = NULL; sc->dma_rxd_tag = NULL;
sc->rxd_base_dma = NULL; sc->rxd_base_dma = NULL;
sc->dma_rxd_busaddr = 0;
} }
if (sc->dma_parent_tag != NULL) { if (sc->dma_parent_tag != NULL) {
bus_dma_tag_destroy(sc->dma_parent_tag); bus_dma_tag_destroy(sc->dma_parent_tag);

View File

@ -1229,76 +1229,71 @@ age_dma_free(struct age_softc *sc)
} }
/* Tx ring. */ /* Tx ring. */
if (sc->age_cdata.age_tx_ring_tag != NULL) { if (sc->age_cdata.age_tx_ring_tag != NULL) {
if (sc->age_cdata.age_tx_ring_map != NULL) if (sc->age_rdata.age_tx_ring_paddr != 0)
bus_dmamap_unload(sc->age_cdata.age_tx_ring_tag, bus_dmamap_unload(sc->age_cdata.age_tx_ring_tag,
sc->age_cdata.age_tx_ring_map); sc->age_cdata.age_tx_ring_map);
if (sc->age_cdata.age_tx_ring_map != NULL && if (sc->age_rdata.age_tx_ring != NULL)
sc->age_rdata.age_tx_ring != NULL)
bus_dmamem_free(sc->age_cdata.age_tx_ring_tag, bus_dmamem_free(sc->age_cdata.age_tx_ring_tag,
sc->age_rdata.age_tx_ring, sc->age_rdata.age_tx_ring,
sc->age_cdata.age_tx_ring_map); sc->age_cdata.age_tx_ring_map);
sc->age_rdata.age_tx_ring_paddr = 0;
sc->age_rdata.age_tx_ring = NULL; sc->age_rdata.age_tx_ring = NULL;
sc->age_cdata.age_tx_ring_map = NULL;
bus_dma_tag_destroy(sc->age_cdata.age_tx_ring_tag); bus_dma_tag_destroy(sc->age_cdata.age_tx_ring_tag);
sc->age_cdata.age_tx_ring_tag = NULL; sc->age_cdata.age_tx_ring_tag = NULL;
} }
/* Rx ring. */ /* Rx ring. */
if (sc->age_cdata.age_rx_ring_tag != NULL) { if (sc->age_cdata.age_rx_ring_tag != NULL) {
if (sc->age_cdata.age_rx_ring_map != NULL) if (sc->age_rdata.age_rx_ring_paddr != 0)
bus_dmamap_unload(sc->age_cdata.age_rx_ring_tag, bus_dmamap_unload(sc->age_cdata.age_rx_ring_tag,
sc->age_cdata.age_rx_ring_map); sc->age_cdata.age_rx_ring_map);
if (sc->age_cdata.age_rx_ring_map != NULL && if (sc->age_rdata.age_rx_ring != NULL)
sc->age_rdata.age_rx_ring != NULL)
bus_dmamem_free(sc->age_cdata.age_rx_ring_tag, bus_dmamem_free(sc->age_cdata.age_rx_ring_tag,
sc->age_rdata.age_rx_ring, sc->age_rdata.age_rx_ring,
sc->age_cdata.age_rx_ring_map); sc->age_cdata.age_rx_ring_map);
sc->age_rdata.age_rx_ring_paddr = 0;
sc->age_rdata.age_rx_ring = NULL; sc->age_rdata.age_rx_ring = NULL;
sc->age_cdata.age_rx_ring_map = NULL;
bus_dma_tag_destroy(sc->age_cdata.age_rx_ring_tag); bus_dma_tag_destroy(sc->age_cdata.age_rx_ring_tag);
sc->age_cdata.age_rx_ring_tag = NULL; sc->age_cdata.age_rx_ring_tag = NULL;
} }
/* Rx return ring. */ /* Rx return ring. */
if (sc->age_cdata.age_rr_ring_tag != NULL) { if (sc->age_cdata.age_rr_ring_tag != NULL) {
if (sc->age_cdata.age_rr_ring_map != NULL) if (sc->age_rdata.age_rr_ring_paddr != 0)
bus_dmamap_unload(sc->age_cdata.age_rr_ring_tag, bus_dmamap_unload(sc->age_cdata.age_rr_ring_tag,
sc->age_cdata.age_rr_ring_map); sc->age_cdata.age_rr_ring_map);
if (sc->age_cdata.age_rr_ring_map != NULL && if (sc->age_rdata.age_rr_ring != NULL)
sc->age_rdata.age_rr_ring != NULL)
bus_dmamem_free(sc->age_cdata.age_rr_ring_tag, bus_dmamem_free(sc->age_cdata.age_rr_ring_tag,
sc->age_rdata.age_rr_ring, sc->age_rdata.age_rr_ring,
sc->age_cdata.age_rr_ring_map); sc->age_cdata.age_rr_ring_map);
sc->age_rdata.age_rr_ring_paddr = 0;
sc->age_rdata.age_rr_ring = NULL; sc->age_rdata.age_rr_ring = NULL;
sc->age_cdata.age_rr_ring_map = NULL;
bus_dma_tag_destroy(sc->age_cdata.age_rr_ring_tag); bus_dma_tag_destroy(sc->age_cdata.age_rr_ring_tag);
sc->age_cdata.age_rr_ring_tag = NULL; sc->age_cdata.age_rr_ring_tag = NULL;
} }
/* CMB block */ /* CMB block */
if (sc->age_cdata.age_cmb_block_tag != NULL) { if (sc->age_cdata.age_cmb_block_tag != NULL) {
if (sc->age_cdata.age_cmb_block_map != NULL) if (sc->age_rdata.age_cmb_block_paddr != 0)
bus_dmamap_unload(sc->age_cdata.age_cmb_block_tag, bus_dmamap_unload(sc->age_cdata.age_cmb_block_tag,
sc->age_cdata.age_cmb_block_map); sc->age_cdata.age_cmb_block_map);
if (sc->age_cdata.age_cmb_block_map != NULL && if (sc->age_rdata.age_cmb_block != NULL)
sc->age_rdata.age_cmb_block != NULL)
bus_dmamem_free(sc->age_cdata.age_cmb_block_tag, bus_dmamem_free(sc->age_cdata.age_cmb_block_tag,
sc->age_rdata.age_cmb_block, sc->age_rdata.age_cmb_block,
sc->age_cdata.age_cmb_block_map); sc->age_cdata.age_cmb_block_map);
sc->age_rdata.age_cmb_block_paddr = 0;
sc->age_rdata.age_cmb_block = NULL; sc->age_rdata.age_cmb_block = NULL;
sc->age_cdata.age_cmb_block_map = NULL;
bus_dma_tag_destroy(sc->age_cdata.age_cmb_block_tag); bus_dma_tag_destroy(sc->age_cdata.age_cmb_block_tag);
sc->age_cdata.age_cmb_block_tag = NULL; sc->age_cdata.age_cmb_block_tag = NULL;
} }
/* SMB block */ /* SMB block */
if (sc->age_cdata.age_smb_block_tag != NULL) { if (sc->age_cdata.age_smb_block_tag != NULL) {
if (sc->age_cdata.age_smb_block_map != NULL) if (sc->age_rdata.age_smb_block_paddr != 0)
bus_dmamap_unload(sc->age_cdata.age_smb_block_tag, bus_dmamap_unload(sc->age_cdata.age_smb_block_tag,
sc->age_cdata.age_smb_block_map); sc->age_cdata.age_smb_block_map);
if (sc->age_cdata.age_smb_block_map != NULL && if (sc->age_rdata.age_smb_block != NULL)
sc->age_rdata.age_smb_block != NULL)
bus_dmamem_free(sc->age_cdata.age_smb_block_tag, bus_dmamem_free(sc->age_cdata.age_smb_block_tag,
sc->age_rdata.age_smb_block, sc->age_rdata.age_smb_block,
sc->age_cdata.age_smb_block_map); sc->age_cdata.age_smb_block_map);
sc->age_rdata.age_smb_block_paddr = 0;
sc->age_rdata.age_smb_block = NULL; sc->age_rdata.age_smb_block = NULL;
sc->age_cdata.age_smb_block_map = NULL;
bus_dma_tag_destroy(sc->age_cdata.age_smb_block_tag); bus_dma_tag_destroy(sc->age_cdata.age_smb_block_tag);
sc->age_cdata.age_smb_block_tag = NULL; sc->age_cdata.age_smb_block_tag = NULL;
} }

View File

@ -1735,76 +1735,71 @@ alc_dma_free(struct alc_softc *sc)
} }
/* Tx descriptor ring. */ /* Tx descriptor ring. */
if (sc->alc_cdata.alc_tx_ring_tag != NULL) { if (sc->alc_cdata.alc_tx_ring_tag != NULL) {
if (sc->alc_cdata.alc_tx_ring_map != NULL) if (sc->alc_rdata.alc_tx_ring_paddr != 0)
bus_dmamap_unload(sc->alc_cdata.alc_tx_ring_tag, bus_dmamap_unload(sc->alc_cdata.alc_tx_ring_tag,
sc->alc_cdata.alc_tx_ring_map); sc->alc_cdata.alc_tx_ring_map);
if (sc->alc_cdata.alc_tx_ring_map != NULL && if (sc->alc_rdata.alc_tx_ring != NULL)
sc->alc_rdata.alc_tx_ring != NULL)
bus_dmamem_free(sc->alc_cdata.alc_tx_ring_tag, bus_dmamem_free(sc->alc_cdata.alc_tx_ring_tag,
sc->alc_rdata.alc_tx_ring, sc->alc_rdata.alc_tx_ring,
sc->alc_cdata.alc_tx_ring_map); sc->alc_cdata.alc_tx_ring_map);
sc->alc_rdata.alc_tx_ring_paddr = 0;
sc->alc_rdata.alc_tx_ring = NULL; sc->alc_rdata.alc_tx_ring = NULL;
sc->alc_cdata.alc_tx_ring_map = NULL;
bus_dma_tag_destroy(sc->alc_cdata.alc_tx_ring_tag); bus_dma_tag_destroy(sc->alc_cdata.alc_tx_ring_tag);
sc->alc_cdata.alc_tx_ring_tag = NULL; sc->alc_cdata.alc_tx_ring_tag = NULL;
} }
/* Rx ring. */ /* Rx ring. */
if (sc->alc_cdata.alc_rx_ring_tag != NULL) { if (sc->alc_cdata.alc_rx_ring_tag != NULL) {
if (sc->alc_cdata.alc_rx_ring_map != NULL) if (sc->alc_rdata.alc_rx_ring_paddr != 0)
bus_dmamap_unload(sc->alc_cdata.alc_rx_ring_tag, bus_dmamap_unload(sc->alc_cdata.alc_rx_ring_tag,
sc->alc_cdata.alc_rx_ring_map); sc->alc_cdata.alc_rx_ring_map);
if (sc->alc_cdata.alc_rx_ring_map != NULL && if (sc->alc_rdata.alc_rx_ring != NULL)
sc->alc_rdata.alc_rx_ring != NULL)
bus_dmamem_free(sc->alc_cdata.alc_rx_ring_tag, bus_dmamem_free(sc->alc_cdata.alc_rx_ring_tag,
sc->alc_rdata.alc_rx_ring, sc->alc_rdata.alc_rx_ring,
sc->alc_cdata.alc_rx_ring_map); sc->alc_cdata.alc_rx_ring_map);
sc->alc_rdata.alc_rx_ring_paddr = 0;
sc->alc_rdata.alc_rx_ring = NULL; sc->alc_rdata.alc_rx_ring = NULL;
sc->alc_cdata.alc_rx_ring_map = NULL;
bus_dma_tag_destroy(sc->alc_cdata.alc_rx_ring_tag); bus_dma_tag_destroy(sc->alc_cdata.alc_rx_ring_tag);
sc->alc_cdata.alc_rx_ring_tag = NULL; sc->alc_cdata.alc_rx_ring_tag = NULL;
} }
/* Rx return ring. */ /* Rx return ring. */
if (sc->alc_cdata.alc_rr_ring_tag != NULL) { if (sc->alc_cdata.alc_rr_ring_tag != NULL) {
if (sc->alc_cdata.alc_rr_ring_map != NULL) if (sc->alc_rdata.alc_rr_ring_paddr != 0)
bus_dmamap_unload(sc->alc_cdata.alc_rr_ring_tag, bus_dmamap_unload(sc->alc_cdata.alc_rr_ring_tag,
sc->alc_cdata.alc_rr_ring_map); sc->alc_cdata.alc_rr_ring_map);
if (sc->alc_cdata.alc_rr_ring_map != NULL && if (sc->alc_rdata.alc_rr_ring != NULL)
sc->alc_rdata.alc_rr_ring != NULL)
bus_dmamem_free(sc->alc_cdata.alc_rr_ring_tag, bus_dmamem_free(sc->alc_cdata.alc_rr_ring_tag,
sc->alc_rdata.alc_rr_ring, sc->alc_rdata.alc_rr_ring,
sc->alc_cdata.alc_rr_ring_map); sc->alc_cdata.alc_rr_ring_map);
sc->alc_rdata.alc_rr_ring_paddr = 0;
sc->alc_rdata.alc_rr_ring = NULL; sc->alc_rdata.alc_rr_ring = NULL;
sc->alc_cdata.alc_rr_ring_map = NULL;
bus_dma_tag_destroy(sc->alc_cdata.alc_rr_ring_tag); bus_dma_tag_destroy(sc->alc_cdata.alc_rr_ring_tag);
sc->alc_cdata.alc_rr_ring_tag = NULL; sc->alc_cdata.alc_rr_ring_tag = NULL;
} }
/* CMB block */ /* CMB block */
if (sc->alc_cdata.alc_cmb_tag != NULL) { if (sc->alc_cdata.alc_cmb_tag != NULL) {
if (sc->alc_cdata.alc_cmb_map != NULL) if (sc->alc_rdata.alc_cmb_paddr != 0)
bus_dmamap_unload(sc->alc_cdata.alc_cmb_tag, bus_dmamap_unload(sc->alc_cdata.alc_cmb_tag,
sc->alc_cdata.alc_cmb_map); sc->alc_cdata.alc_cmb_map);
if (sc->alc_cdata.alc_cmb_map != NULL && if (sc->alc_rdata.alc_cmb != NULL)
sc->alc_rdata.alc_cmb != NULL)
bus_dmamem_free(sc->alc_cdata.alc_cmb_tag, bus_dmamem_free(sc->alc_cdata.alc_cmb_tag,
sc->alc_rdata.alc_cmb, sc->alc_rdata.alc_cmb,
sc->alc_cdata.alc_cmb_map); sc->alc_cdata.alc_cmb_map);
sc->alc_rdata.alc_cmb_paddr = 0;
sc->alc_rdata.alc_cmb = NULL; sc->alc_rdata.alc_cmb = NULL;
sc->alc_cdata.alc_cmb_map = NULL;
bus_dma_tag_destroy(sc->alc_cdata.alc_cmb_tag); bus_dma_tag_destroy(sc->alc_cdata.alc_cmb_tag);
sc->alc_cdata.alc_cmb_tag = NULL; sc->alc_cdata.alc_cmb_tag = NULL;
} }
/* SMB block */ /* SMB block */
if (sc->alc_cdata.alc_smb_tag != NULL) { if (sc->alc_cdata.alc_smb_tag != NULL) {
if (sc->alc_cdata.alc_smb_map != NULL) if (sc->alc_rdata.alc_smb_paddr != 0)
bus_dmamap_unload(sc->alc_cdata.alc_smb_tag, bus_dmamap_unload(sc->alc_cdata.alc_smb_tag,
sc->alc_cdata.alc_smb_map); sc->alc_cdata.alc_smb_map);
if (sc->alc_cdata.alc_smb_map != NULL && if (sc->alc_rdata.alc_smb != NULL)
sc->alc_rdata.alc_smb != NULL)
bus_dmamem_free(sc->alc_cdata.alc_smb_tag, bus_dmamem_free(sc->alc_cdata.alc_smb_tag,
sc->alc_rdata.alc_smb, sc->alc_rdata.alc_smb,
sc->alc_cdata.alc_smb_map); sc->alc_cdata.alc_smb_map);
sc->alc_rdata.alc_smb_paddr = 0;
sc->alc_rdata.alc_smb = NULL; sc->alc_rdata.alc_smb = NULL;
sc->alc_cdata.alc_smb_map = NULL;
bus_dma_tag_destroy(sc->alc_cdata.alc_smb_tag); bus_dma_tag_destroy(sc->alc_cdata.alc_smb_tag);
sc->alc_cdata.alc_smb_tag = NULL; sc->alc_cdata.alc_smb_tag = NULL;
} }

View File

@ -1330,34 +1330,32 @@ ale_dma_free(struct ale_softc *sc)
} }
/* Tx descriptor ring. */ /* Tx descriptor ring. */
if (sc->ale_cdata.ale_tx_ring_tag != NULL) { if (sc->ale_cdata.ale_tx_ring_tag != NULL) {
if (sc->ale_cdata.ale_tx_ring_map != NULL) if (sc->ale_cdata.ale_tx_ring_paddr != 0)
bus_dmamap_unload(sc->ale_cdata.ale_tx_ring_tag, bus_dmamap_unload(sc->ale_cdata.ale_tx_ring_tag,
sc->ale_cdata.ale_tx_ring_map); sc->ale_cdata.ale_tx_ring_map);
if (sc->ale_cdata.ale_tx_ring_map != NULL && if (sc->ale_cdata.ale_tx_ring != NULL)
sc->ale_cdata.ale_tx_ring != NULL)
bus_dmamem_free(sc->ale_cdata.ale_tx_ring_tag, bus_dmamem_free(sc->ale_cdata.ale_tx_ring_tag,
sc->ale_cdata.ale_tx_ring, sc->ale_cdata.ale_tx_ring,
sc->ale_cdata.ale_tx_ring_map); sc->ale_cdata.ale_tx_ring_map);
sc->ale_cdata.ale_tx_ring_paddr = 0;
sc->ale_cdata.ale_tx_ring = NULL; sc->ale_cdata.ale_tx_ring = NULL;
sc->ale_cdata.ale_tx_ring_map = NULL;
bus_dma_tag_destroy(sc->ale_cdata.ale_tx_ring_tag); bus_dma_tag_destroy(sc->ale_cdata.ale_tx_ring_tag);
sc->ale_cdata.ale_tx_ring_tag = NULL; sc->ale_cdata.ale_tx_ring_tag = NULL;
} }
/* Rx page block. */ /* Rx page block. */
for (i = 0; i < ALE_RX_PAGES; i++) { for (i = 0; i < ALE_RX_PAGES; i++) {
if (sc->ale_cdata.ale_rx_page[i].page_tag != NULL) { if (sc->ale_cdata.ale_rx_page[i].page_tag != NULL) {
if (sc->ale_cdata.ale_rx_page[i].page_map != NULL) if (sc->ale_cdata.ale_rx_page[i].page_paddr != 0)
bus_dmamap_unload( bus_dmamap_unload(
sc->ale_cdata.ale_rx_page[i].page_tag, sc->ale_cdata.ale_rx_page[i].page_tag,
sc->ale_cdata.ale_rx_page[i].page_map); sc->ale_cdata.ale_rx_page[i].page_map);
if (sc->ale_cdata.ale_rx_page[i].page_map != NULL && if (sc->ale_cdata.ale_rx_page[i].page_addr != NULL)
sc->ale_cdata.ale_rx_page[i].page_addr != NULL)
bus_dmamem_free( bus_dmamem_free(
sc->ale_cdata.ale_rx_page[i].page_tag, sc->ale_cdata.ale_rx_page[i].page_tag,
sc->ale_cdata.ale_rx_page[i].page_addr, sc->ale_cdata.ale_rx_page[i].page_addr,
sc->ale_cdata.ale_rx_page[i].page_map); sc->ale_cdata.ale_rx_page[i].page_map);
sc->ale_cdata.ale_rx_page[i].page_paddr = 0;
sc->ale_cdata.ale_rx_page[i].page_addr = NULL; sc->ale_cdata.ale_rx_page[i].page_addr = NULL;
sc->ale_cdata.ale_rx_page[i].page_map = NULL;
bus_dma_tag_destroy( bus_dma_tag_destroy(
sc->ale_cdata.ale_rx_page[i].page_tag); sc->ale_cdata.ale_rx_page[i].page_tag);
sc->ale_cdata.ale_rx_page[i].page_tag = NULL; sc->ale_cdata.ale_rx_page[i].page_tag = NULL;
@ -1366,18 +1364,17 @@ ale_dma_free(struct ale_softc *sc)
/* Rx CMB. */ /* Rx CMB. */
for (i = 0; i < ALE_RX_PAGES; i++) { for (i = 0; i < ALE_RX_PAGES; i++) {
if (sc->ale_cdata.ale_rx_page[i].cmb_tag != NULL) { if (sc->ale_cdata.ale_rx_page[i].cmb_tag != NULL) {
if (sc->ale_cdata.ale_rx_page[i].cmb_map != NULL) if (sc->ale_cdata.ale_rx_page[i].cmb_paddr != 0)
bus_dmamap_unload( bus_dmamap_unload(
sc->ale_cdata.ale_rx_page[i].cmb_tag, sc->ale_cdata.ale_rx_page[i].cmb_tag,
sc->ale_cdata.ale_rx_page[i].cmb_map); sc->ale_cdata.ale_rx_page[i].cmb_map);
if (sc->ale_cdata.ale_rx_page[i].cmb_map != NULL && if (sc->ale_cdata.ale_rx_page[i].cmb_addr != NULL)
sc->ale_cdata.ale_rx_page[i].cmb_addr != NULL)
bus_dmamem_free( bus_dmamem_free(
sc->ale_cdata.ale_rx_page[i].cmb_tag, sc->ale_cdata.ale_rx_page[i].cmb_tag,
sc->ale_cdata.ale_rx_page[i].cmb_addr, sc->ale_cdata.ale_rx_page[i].cmb_addr,
sc->ale_cdata.ale_rx_page[i].cmb_map); sc->ale_cdata.ale_rx_page[i].cmb_map);
sc->ale_cdata.ale_rx_page[i].cmb_paddr = 0;
sc->ale_cdata.ale_rx_page[i].cmb_addr = NULL; sc->ale_cdata.ale_rx_page[i].cmb_addr = NULL;
sc->ale_cdata.ale_rx_page[i].cmb_map = NULL;
bus_dma_tag_destroy( bus_dma_tag_destroy(
sc->ale_cdata.ale_rx_page[i].cmb_tag); sc->ale_cdata.ale_rx_page[i].cmb_tag);
sc->ale_cdata.ale_rx_page[i].cmb_tag = NULL; sc->ale_cdata.ale_rx_page[i].cmb_tag = NULL;
@ -1385,16 +1382,15 @@ ale_dma_free(struct ale_softc *sc)
} }
/* Tx CMB. */ /* Tx CMB. */
if (sc->ale_cdata.ale_tx_cmb_tag != NULL) { if (sc->ale_cdata.ale_tx_cmb_tag != NULL) {
if (sc->ale_cdata.ale_tx_cmb_map != NULL) if (sc->ale_cdata.ale_tx_cmb_paddr != 0)
bus_dmamap_unload(sc->ale_cdata.ale_tx_cmb_tag, bus_dmamap_unload(sc->ale_cdata.ale_tx_cmb_tag,
sc->ale_cdata.ale_tx_cmb_map); sc->ale_cdata.ale_tx_cmb_map);
if (sc->ale_cdata.ale_tx_cmb_map != NULL && if (sc->ale_cdata.ale_tx_cmb != NULL)
sc->ale_cdata.ale_tx_cmb != NULL)
bus_dmamem_free(sc->ale_cdata.ale_tx_cmb_tag, bus_dmamem_free(sc->ale_cdata.ale_tx_cmb_tag,
sc->ale_cdata.ale_tx_cmb, sc->ale_cdata.ale_tx_cmb,
sc->ale_cdata.ale_tx_cmb_map); sc->ale_cdata.ale_tx_cmb_map);
sc->ale_cdata.ale_tx_cmb_paddr = 0;
sc->ale_cdata.ale_tx_cmb = NULL; sc->ale_cdata.ale_tx_cmb = NULL;
sc->ale_cdata.ale_tx_cmb_map = NULL;
bus_dma_tag_destroy(sc->ale_cdata.ale_tx_cmb_tag); bus_dma_tag_destroy(sc->ale_cdata.ale_tx_cmb_tag);
sc->ale_cdata.ale_tx_cmb_tag = NULL; sc->ale_cdata.ale_tx_cmb_tag = NULL;
} }

View File

@ -364,12 +364,12 @@ bfe_dma_free(struct bfe_softc *sc)
/* Tx ring. */ /* Tx ring. */
if (sc->bfe_tx_tag != NULL) { if (sc->bfe_tx_tag != NULL) {
if (sc->bfe_tx_map != NULL) if (sc->bfe_tx_dma != 0)
bus_dmamap_unload(sc->bfe_tx_tag, sc->bfe_tx_map); bus_dmamap_unload(sc->bfe_tx_tag, sc->bfe_tx_map);
if (sc->bfe_tx_map != NULL && sc->bfe_tx_list != NULL) if (sc->bfe_tx_list != NULL)
bus_dmamem_free(sc->bfe_tx_tag, sc->bfe_tx_list, bus_dmamem_free(sc->bfe_tx_tag, sc->bfe_tx_list,
sc->bfe_tx_map); sc->bfe_tx_map);
sc->bfe_tx_map = NULL; sc->bfe_tx_dma = 0;
sc->bfe_tx_list = NULL; sc->bfe_tx_list = NULL;
bus_dma_tag_destroy(sc->bfe_tx_tag); bus_dma_tag_destroy(sc->bfe_tx_tag);
sc->bfe_tx_tag = NULL; sc->bfe_tx_tag = NULL;
@ -377,12 +377,12 @@ bfe_dma_free(struct bfe_softc *sc)
/* Rx ring. */ /* Rx ring. */
if (sc->bfe_rx_tag != NULL) { if (sc->bfe_rx_tag != NULL) {
if (sc->bfe_rx_map != NULL) if (sc->bfe_rx_dma != 0)
bus_dmamap_unload(sc->bfe_rx_tag, sc->bfe_rx_map); bus_dmamap_unload(sc->bfe_rx_tag, sc->bfe_rx_map);
if (sc->bfe_rx_map != NULL && sc->bfe_rx_list != NULL) if (sc->bfe_rx_list != NULL)
bus_dmamem_free(sc->bfe_rx_tag, sc->bfe_rx_list, bus_dmamem_free(sc->bfe_rx_tag, sc->bfe_rx_list,
sc->bfe_rx_map); sc->bfe_rx_map);
sc->bfe_rx_map = NULL; sc->bfe_rx_dma = 0;
sc->bfe_rx_list = NULL; sc->bfe_rx_list = NULL;
bus_dma_tag_destroy(sc->bfe_rx_tag); bus_dma_tag_destroy(sc->bfe_rx_tag);
sc->bfe_rx_tag = NULL; sc->bfe_rx_tag = NULL;

View File

@ -2817,10 +2817,10 @@ bge_dma_free(struct bge_softc *sc)
bus_dma_tag_destroy(sc->bge_cdata.bge_tx_mtag); bus_dma_tag_destroy(sc->bge_cdata.bge_tx_mtag);
/* Destroy standard RX ring. */ /* Destroy standard RX ring. */
if (sc->bge_cdata.bge_rx_std_ring_map) if (sc->bge_ldata.bge_rx_std_ring_paddr)
bus_dmamap_unload(sc->bge_cdata.bge_rx_std_ring_tag, bus_dmamap_unload(sc->bge_cdata.bge_rx_std_ring_tag,
sc->bge_cdata.bge_rx_std_ring_map); sc->bge_cdata.bge_rx_std_ring_map);
if (sc->bge_cdata.bge_rx_std_ring_map && sc->bge_ldata.bge_rx_std_ring) if (sc->bge_ldata.bge_rx_std_ring)
bus_dmamem_free(sc->bge_cdata.bge_rx_std_ring_tag, bus_dmamem_free(sc->bge_cdata.bge_rx_std_ring_tag,
sc->bge_ldata.bge_rx_std_ring, sc->bge_ldata.bge_rx_std_ring,
sc->bge_cdata.bge_rx_std_ring_map); sc->bge_cdata.bge_rx_std_ring_map);
@ -2829,12 +2829,11 @@ bge_dma_free(struct bge_softc *sc)
bus_dma_tag_destroy(sc->bge_cdata.bge_rx_std_ring_tag); bus_dma_tag_destroy(sc->bge_cdata.bge_rx_std_ring_tag);
/* Destroy jumbo RX ring. */ /* Destroy jumbo RX ring. */
if (sc->bge_cdata.bge_rx_jumbo_ring_map) if (sc->bge_ldata.bge_rx_jumbo_ring_paddr)
bus_dmamap_unload(sc->bge_cdata.bge_rx_jumbo_ring_tag, bus_dmamap_unload(sc->bge_cdata.bge_rx_jumbo_ring_tag,
sc->bge_cdata.bge_rx_jumbo_ring_map); sc->bge_cdata.bge_rx_jumbo_ring_map);
if (sc->bge_cdata.bge_rx_jumbo_ring_map && if (sc->bge_ldata.bge_rx_jumbo_ring)
sc->bge_ldata.bge_rx_jumbo_ring)
bus_dmamem_free(sc->bge_cdata.bge_rx_jumbo_ring_tag, bus_dmamem_free(sc->bge_cdata.bge_rx_jumbo_ring_tag,
sc->bge_ldata.bge_rx_jumbo_ring, sc->bge_ldata.bge_rx_jumbo_ring,
sc->bge_cdata.bge_rx_jumbo_ring_map); sc->bge_cdata.bge_rx_jumbo_ring_map);
@ -2843,12 +2842,11 @@ bge_dma_free(struct bge_softc *sc)
bus_dma_tag_destroy(sc->bge_cdata.bge_rx_jumbo_ring_tag); bus_dma_tag_destroy(sc->bge_cdata.bge_rx_jumbo_ring_tag);
/* Destroy RX return ring. */ /* Destroy RX return ring. */
if (sc->bge_cdata.bge_rx_return_ring_map) if (sc->bge_ldata.bge_rx_return_ring_paddr)
bus_dmamap_unload(sc->bge_cdata.bge_rx_return_ring_tag, bus_dmamap_unload(sc->bge_cdata.bge_rx_return_ring_tag,
sc->bge_cdata.bge_rx_return_ring_map); sc->bge_cdata.bge_rx_return_ring_map);
if (sc->bge_cdata.bge_rx_return_ring_map && if (sc->bge_ldata.bge_rx_return_ring)
sc->bge_ldata.bge_rx_return_ring)
bus_dmamem_free(sc->bge_cdata.bge_rx_return_ring_tag, bus_dmamem_free(sc->bge_cdata.bge_rx_return_ring_tag,
sc->bge_ldata.bge_rx_return_ring, sc->bge_ldata.bge_rx_return_ring,
sc->bge_cdata.bge_rx_return_ring_map); sc->bge_cdata.bge_rx_return_ring_map);
@ -2857,11 +2855,11 @@ bge_dma_free(struct bge_softc *sc)
bus_dma_tag_destroy(sc->bge_cdata.bge_rx_return_ring_tag); bus_dma_tag_destroy(sc->bge_cdata.bge_rx_return_ring_tag);
/* Destroy TX ring. */ /* Destroy TX ring. */
if (sc->bge_cdata.bge_tx_ring_map) if (sc->bge_ldata.bge_tx_ring_paddr)
bus_dmamap_unload(sc->bge_cdata.bge_tx_ring_tag, bus_dmamap_unload(sc->bge_cdata.bge_tx_ring_tag,
sc->bge_cdata.bge_tx_ring_map); sc->bge_cdata.bge_tx_ring_map);
if (sc->bge_cdata.bge_tx_ring_map && sc->bge_ldata.bge_tx_ring) if (sc->bge_ldata.bge_tx_ring)
bus_dmamem_free(sc->bge_cdata.bge_tx_ring_tag, bus_dmamem_free(sc->bge_cdata.bge_tx_ring_tag,
sc->bge_ldata.bge_tx_ring, sc->bge_ldata.bge_tx_ring,
sc->bge_cdata.bge_tx_ring_map); sc->bge_cdata.bge_tx_ring_map);
@ -2870,11 +2868,11 @@ bge_dma_free(struct bge_softc *sc)
bus_dma_tag_destroy(sc->bge_cdata.bge_tx_ring_tag); bus_dma_tag_destroy(sc->bge_cdata.bge_tx_ring_tag);
/* Destroy status block. */ /* Destroy status block. */
if (sc->bge_cdata.bge_status_map) if (sc->bge_ldata.bge_status_block_paddr)
bus_dmamap_unload(sc->bge_cdata.bge_status_tag, bus_dmamap_unload(sc->bge_cdata.bge_status_tag,
sc->bge_cdata.bge_status_map); sc->bge_cdata.bge_status_map);
if (sc->bge_cdata.bge_status_map && sc->bge_ldata.bge_status_block) if (sc->bge_ldata.bge_status_block)
bus_dmamem_free(sc->bge_cdata.bge_status_tag, bus_dmamem_free(sc->bge_cdata.bge_status_tag,
sc->bge_ldata.bge_status_block, sc->bge_ldata.bge_status_block,
sc->bge_cdata.bge_status_map); sc->bge_cdata.bge_status_map);
@ -2883,11 +2881,11 @@ bge_dma_free(struct bge_softc *sc)
bus_dma_tag_destroy(sc->bge_cdata.bge_status_tag); bus_dma_tag_destroy(sc->bge_cdata.bge_status_tag);
/* Destroy statistics block. */ /* Destroy statistics block. */
if (sc->bge_cdata.bge_stats_map) if (sc->bge_ldata.bge_stats_paddr)
bus_dmamap_unload(sc->bge_cdata.bge_stats_tag, bus_dmamap_unload(sc->bge_cdata.bge_stats_tag,
sc->bge_cdata.bge_stats_map); sc->bge_cdata.bge_stats_map);
if (sc->bge_cdata.bge_stats_map && sc->bge_ldata.bge_stats) if (sc->bge_ldata.bge_stats)
bus_dmamem_free(sc->bge_cdata.bge_stats_tag, bus_dmamem_free(sc->bge_cdata.bge_stats_tag,
sc->bge_ldata.bge_stats, sc->bge_ldata.bge_stats,
sc->bge_cdata.bge_stats_map); sc->bge_cdata.bge_stats_map);

View File

@ -1982,9 +1982,9 @@ dc_dma_free(struct dc_softc *sc)
/* RX descriptor list. */ /* RX descriptor list. */
if (sc->dc_rx_ltag) { if (sc->dc_rx_ltag) {
if (sc->dc_rx_lmap != NULL) if (sc->dc_ldata.dc_rx_list_paddr != 0)
bus_dmamap_unload(sc->dc_rx_ltag, sc->dc_rx_lmap); bus_dmamap_unload(sc->dc_rx_ltag, sc->dc_rx_lmap);
if (sc->dc_rx_lmap != NULL && sc->dc_ldata.dc_rx_list != NULL) if (sc->dc_ldata.dc_rx_list != NULL)
bus_dmamem_free(sc->dc_rx_ltag, sc->dc_ldata.dc_rx_list, bus_dmamem_free(sc->dc_rx_ltag, sc->dc_ldata.dc_rx_list,
sc->dc_rx_lmap); sc->dc_rx_lmap);
bus_dma_tag_destroy(sc->dc_rx_ltag); bus_dma_tag_destroy(sc->dc_rx_ltag);
@ -1992,9 +1992,9 @@ dc_dma_free(struct dc_softc *sc)
/* TX descriptor list. */ /* TX descriptor list. */
if (sc->dc_tx_ltag) { if (sc->dc_tx_ltag) {
if (sc->dc_tx_lmap != NULL) if (sc->dc_ldata.dc_tx_list_paddr != 0)
bus_dmamap_unload(sc->dc_tx_ltag, sc->dc_tx_lmap); bus_dmamap_unload(sc->dc_tx_ltag, sc->dc_tx_lmap);
if (sc->dc_tx_lmap != NULL && sc->dc_ldata.dc_tx_list != NULL) if (sc->dc_ldata.dc_tx_list != NULL)
bus_dmamem_free(sc->dc_tx_ltag, sc->dc_ldata.dc_tx_list, bus_dmamem_free(sc->dc_tx_ltag, sc->dc_ldata.dc_tx_list,
sc->dc_tx_lmap); sc->dc_tx_lmap);
bus_dma_tag_destroy(sc->dc_tx_ltag); bus_dma_tag_destroy(sc->dc_tx_ltag);
@ -2002,9 +2002,9 @@ dc_dma_free(struct dc_softc *sc)
/* multicast setup frame. */ /* multicast setup frame. */
if (sc->dc_stag) { if (sc->dc_stag) {
if (sc->dc_smap != NULL) if (sc->dc_saddr != 0)
bus_dmamap_unload(sc->dc_stag, sc->dc_smap); bus_dmamap_unload(sc->dc_stag, sc->dc_smap);
if (sc->dc_smap != NULL && sc->dc_cdata.dc_sbuf != NULL) if (sc->dc_cdata.dc_sbuf != NULL)
bus_dmamem_free(sc->dc_stag, sc->dc_cdata.dc_sbuf, bus_dmamem_free(sc->dc_stag, sc->dc_cdata.dc_sbuf,
sc->dc_smap); sc->dc_smap);
bus_dma_tag_destroy(sc->dc_stag); bus_dma_tag_destroy(sc->dc_stag);

View File

@ -1408,31 +1408,29 @@ jme_dma_free(struct jme_softc *sc)
/* Tx ring */ /* Tx ring */
if (sc->jme_cdata.jme_tx_ring_tag != NULL) { if (sc->jme_cdata.jme_tx_ring_tag != NULL) {
if (sc->jme_cdata.jme_tx_ring_map) if (sc->jme_rdata.jme_tx_ring_paddr)
bus_dmamap_unload(sc->jme_cdata.jme_tx_ring_tag, bus_dmamap_unload(sc->jme_cdata.jme_tx_ring_tag,
sc->jme_cdata.jme_tx_ring_map); sc->jme_cdata.jme_tx_ring_map);
if (sc->jme_cdata.jme_tx_ring_map && if (sc->jme_rdata.jme_tx_ring)
sc->jme_rdata.jme_tx_ring)
bus_dmamem_free(sc->jme_cdata.jme_tx_ring_tag, bus_dmamem_free(sc->jme_cdata.jme_tx_ring_tag,
sc->jme_rdata.jme_tx_ring, sc->jme_rdata.jme_tx_ring,
sc->jme_cdata.jme_tx_ring_map); sc->jme_cdata.jme_tx_ring_map);
sc->jme_rdata.jme_tx_ring = NULL; sc->jme_rdata.jme_tx_ring = NULL;
sc->jme_cdata.jme_tx_ring_map = NULL; sc->jme_rdata.jme_tx_ring_paddr = 0;
bus_dma_tag_destroy(sc->jme_cdata.jme_tx_ring_tag); bus_dma_tag_destroy(sc->jme_cdata.jme_tx_ring_tag);
sc->jme_cdata.jme_tx_ring_tag = NULL; sc->jme_cdata.jme_tx_ring_tag = NULL;
} }
/* Rx ring */ /* Rx ring */
if (sc->jme_cdata.jme_rx_ring_tag != NULL) { if (sc->jme_cdata.jme_rx_ring_tag != NULL) {
if (sc->jme_cdata.jme_rx_ring_map) if (sc->jme_rdata.jme_rx_ring_paddr)
bus_dmamap_unload(sc->jme_cdata.jme_rx_ring_tag, bus_dmamap_unload(sc->jme_cdata.jme_rx_ring_tag,
sc->jme_cdata.jme_rx_ring_map); sc->jme_cdata.jme_rx_ring_map);
if (sc->jme_cdata.jme_rx_ring_map && if (sc->jme_rdata.jme_rx_ring)
sc->jme_rdata.jme_rx_ring)
bus_dmamem_free(sc->jme_cdata.jme_rx_ring_tag, bus_dmamem_free(sc->jme_cdata.jme_rx_ring_tag,
sc->jme_rdata.jme_rx_ring, sc->jme_rdata.jme_rx_ring,
sc->jme_cdata.jme_rx_ring_map); sc->jme_cdata.jme_rx_ring_map);
sc->jme_rdata.jme_rx_ring = NULL; sc->jme_rdata.jme_rx_ring = NULL;
sc->jme_cdata.jme_rx_ring_map = NULL; sc->jme_rdata.jme_rx_ring_paddr = 0;
bus_dma_tag_destroy(sc->jme_cdata.jme_rx_ring_tag); bus_dma_tag_destroy(sc->jme_cdata.jme_rx_ring_tag);
sc->jme_cdata.jme_rx_ring_tag = NULL; sc->jme_cdata.jme_rx_ring_tag = NULL;
} }
@ -1470,15 +1468,15 @@ jme_dma_free(struct jme_softc *sc)
/* Shared status block. */ /* Shared status block. */
if (sc->jme_cdata.jme_ssb_tag != NULL) { if (sc->jme_cdata.jme_ssb_tag != NULL) {
if (sc->jme_cdata.jme_ssb_map) if (sc->jme_rdata.jme_ssb_block_paddr)
bus_dmamap_unload(sc->jme_cdata.jme_ssb_tag, bus_dmamap_unload(sc->jme_cdata.jme_ssb_tag,
sc->jme_cdata.jme_ssb_map); sc->jme_cdata.jme_ssb_map);
if (sc->jme_cdata.jme_ssb_map && sc->jme_rdata.jme_ssb_block) if (sc->jme_rdata.jme_ssb_block)
bus_dmamem_free(sc->jme_cdata.jme_ssb_tag, bus_dmamem_free(sc->jme_cdata.jme_ssb_tag,
sc->jme_rdata.jme_ssb_block, sc->jme_rdata.jme_ssb_block,
sc->jme_cdata.jme_ssb_map); sc->jme_cdata.jme_ssb_map);
sc->jme_rdata.jme_ssb_block = NULL; sc->jme_rdata.jme_ssb_block = NULL;
sc->jme_cdata.jme_ssb_map = NULL; sc->jme_rdata.jme_ssb_block_paddr = 0;
bus_dma_tag_destroy(sc->jme_cdata.jme_ssb_tag); bus_dma_tag_destroy(sc->jme_cdata.jme_ssb_tag);
sc->jme_cdata.jme_ssb_tag = NULL; sc->jme_cdata.jme_ssb_tag = NULL;
} }

View File

@ -2209,14 +2209,14 @@ msk_status_dma_free(struct msk_softc *sc)
/* Destroy status block. */ /* Destroy status block. */
if (sc->msk_stat_tag) { if (sc->msk_stat_tag) {
if (sc->msk_stat_map) { if (sc->msk_stat_ring_paddr) {
bus_dmamap_unload(sc->msk_stat_tag, sc->msk_stat_map); bus_dmamap_unload(sc->msk_stat_tag, sc->msk_stat_map);
if (sc->msk_stat_ring) { sc->msk_stat_ring_paddr = 0;
bus_dmamem_free(sc->msk_stat_tag, }
sc->msk_stat_ring, sc->msk_stat_map); if (sc->msk_stat_ring) {
sc->msk_stat_ring = NULL; bus_dmamem_free(sc->msk_stat_tag,
} sc->msk_stat_ring, sc->msk_stat_map);
sc->msk_stat_map = NULL; sc->msk_stat_ring = NULL;
} }
bus_dma_tag_destroy(sc->msk_stat_tag); bus_dma_tag_destroy(sc->msk_stat_tag);
sc->msk_stat_tag = NULL; sc->msk_stat_tag = NULL;
@ -2527,31 +2527,29 @@ msk_txrx_dma_free(struct msk_if_softc *sc_if)
/* Tx ring. */ /* Tx ring. */
if (sc_if->msk_cdata.msk_tx_ring_tag) { if (sc_if->msk_cdata.msk_tx_ring_tag) {
if (sc_if->msk_cdata.msk_tx_ring_map) if (sc_if->msk_rdata.msk_tx_ring_paddr)
bus_dmamap_unload(sc_if->msk_cdata.msk_tx_ring_tag, bus_dmamap_unload(sc_if->msk_cdata.msk_tx_ring_tag,
sc_if->msk_cdata.msk_tx_ring_map); sc_if->msk_cdata.msk_tx_ring_map);
if (sc_if->msk_cdata.msk_tx_ring_map && if (sc_if->msk_rdata.msk_tx_ring)
sc_if->msk_rdata.msk_tx_ring)
bus_dmamem_free(sc_if->msk_cdata.msk_tx_ring_tag, bus_dmamem_free(sc_if->msk_cdata.msk_tx_ring_tag,
sc_if->msk_rdata.msk_tx_ring, sc_if->msk_rdata.msk_tx_ring,
sc_if->msk_cdata.msk_tx_ring_map); sc_if->msk_cdata.msk_tx_ring_map);
sc_if->msk_rdata.msk_tx_ring = NULL; sc_if->msk_rdata.msk_tx_ring = NULL;
sc_if->msk_cdata.msk_tx_ring_map = NULL; sc_if->msk_rdata.msk_tx_ring_paddr = 0;
bus_dma_tag_destroy(sc_if->msk_cdata.msk_tx_ring_tag); bus_dma_tag_destroy(sc_if->msk_cdata.msk_tx_ring_tag);
sc_if->msk_cdata.msk_tx_ring_tag = NULL; sc_if->msk_cdata.msk_tx_ring_tag = NULL;
} }
/* Rx ring. */ /* Rx ring. */
if (sc_if->msk_cdata.msk_rx_ring_tag) { if (sc_if->msk_cdata.msk_rx_ring_tag) {
if (sc_if->msk_cdata.msk_rx_ring_map) if (sc_if->msk_rdata.msk_rx_ring_paddr)
bus_dmamap_unload(sc_if->msk_cdata.msk_rx_ring_tag, bus_dmamap_unload(sc_if->msk_cdata.msk_rx_ring_tag,
sc_if->msk_cdata.msk_rx_ring_map); sc_if->msk_cdata.msk_rx_ring_map);
if (sc_if->msk_cdata.msk_rx_ring_map && if (sc_if->msk_rdata.msk_rx_ring)
sc_if->msk_rdata.msk_rx_ring)
bus_dmamem_free(sc_if->msk_cdata.msk_rx_ring_tag, bus_dmamem_free(sc_if->msk_cdata.msk_rx_ring_tag,
sc_if->msk_rdata.msk_rx_ring, sc_if->msk_rdata.msk_rx_ring,
sc_if->msk_cdata.msk_rx_ring_map); sc_if->msk_cdata.msk_rx_ring_map);
sc_if->msk_rdata.msk_rx_ring = NULL; sc_if->msk_rdata.msk_rx_ring = NULL;
sc_if->msk_cdata.msk_rx_ring_map = NULL; sc_if->msk_rdata.msk_rx_ring_paddr = 0;
bus_dma_tag_destroy(sc_if->msk_cdata.msk_rx_ring_tag); bus_dma_tag_destroy(sc_if->msk_cdata.msk_rx_ring_tag);
sc_if->msk_cdata.msk_rx_ring_tag = NULL; sc_if->msk_cdata.msk_rx_ring_tag = NULL;
} }
@ -2600,16 +2598,15 @@ msk_rx_dma_jfree(struct msk_if_softc *sc_if)
/* Jumbo Rx ring. */ /* Jumbo Rx ring. */
if (sc_if->msk_cdata.msk_jumbo_rx_ring_tag) { if (sc_if->msk_cdata.msk_jumbo_rx_ring_tag) {
if (sc_if->msk_cdata.msk_jumbo_rx_ring_map) if (sc_if->msk_rdata.msk_jumbo_rx_ring_paddr)
bus_dmamap_unload(sc_if->msk_cdata.msk_jumbo_rx_ring_tag, bus_dmamap_unload(sc_if->msk_cdata.msk_jumbo_rx_ring_tag,
sc_if->msk_cdata.msk_jumbo_rx_ring_map); sc_if->msk_cdata.msk_jumbo_rx_ring_map);
if (sc_if->msk_cdata.msk_jumbo_rx_ring_map && if (sc_if->msk_rdata.msk_jumbo_rx_ring)
sc_if->msk_rdata.msk_jumbo_rx_ring)
bus_dmamem_free(sc_if->msk_cdata.msk_jumbo_rx_ring_tag, bus_dmamem_free(sc_if->msk_cdata.msk_jumbo_rx_ring_tag,
sc_if->msk_rdata.msk_jumbo_rx_ring, sc_if->msk_rdata.msk_jumbo_rx_ring,
sc_if->msk_cdata.msk_jumbo_rx_ring_map); sc_if->msk_cdata.msk_jumbo_rx_ring_map);
sc_if->msk_rdata.msk_jumbo_rx_ring = NULL; sc_if->msk_rdata.msk_jumbo_rx_ring = NULL;
sc_if->msk_cdata.msk_jumbo_rx_ring_map = NULL; sc_if->msk_rdata.msk_jumbo_rx_ring_paddr = 0;
bus_dma_tag_destroy(sc_if->msk_cdata.msk_jumbo_rx_ring_tag); bus_dma_tag_destroy(sc_if->msk_cdata.msk_jumbo_rx_ring_tag);
sc_if->msk_cdata.msk_jumbo_rx_ring_tag = NULL; sc_if->msk_cdata.msk_jumbo_rx_ring_tag = NULL;
} }

View File

@ -1225,31 +1225,29 @@ nge_dma_free(struct nge_softc *sc)
/* Tx ring. */ /* Tx ring. */
if (sc->nge_cdata.nge_tx_ring_tag) { if (sc->nge_cdata.nge_tx_ring_tag) {
if (sc->nge_cdata.nge_tx_ring_map) if (sc->nge_rdata.nge_tx_ring_paddr)
bus_dmamap_unload(sc->nge_cdata.nge_tx_ring_tag, bus_dmamap_unload(sc->nge_cdata.nge_tx_ring_tag,
sc->nge_cdata.nge_tx_ring_map); sc->nge_cdata.nge_tx_ring_map);
if (sc->nge_cdata.nge_tx_ring_map && if (sc->nge_rdata.nge_tx_ring)
sc->nge_rdata.nge_tx_ring)
bus_dmamem_free(sc->nge_cdata.nge_tx_ring_tag, bus_dmamem_free(sc->nge_cdata.nge_tx_ring_tag,
sc->nge_rdata.nge_tx_ring, sc->nge_rdata.nge_tx_ring,
sc->nge_cdata.nge_tx_ring_map); sc->nge_cdata.nge_tx_ring_map);
sc->nge_rdata.nge_tx_ring = NULL; sc->nge_rdata.nge_tx_ring = NULL;
sc->nge_cdata.nge_tx_ring_map = NULL; sc->nge_rdata.nge_tx_ring_paddr = 0;
bus_dma_tag_destroy(sc->nge_cdata.nge_tx_ring_tag); bus_dma_tag_destroy(sc->nge_cdata.nge_tx_ring_tag);
sc->nge_cdata.nge_tx_ring_tag = NULL; sc->nge_cdata.nge_tx_ring_tag = NULL;
} }
/* Rx ring. */ /* Rx ring. */
if (sc->nge_cdata.nge_rx_ring_tag) { if (sc->nge_cdata.nge_rx_ring_tag) {
if (sc->nge_cdata.nge_rx_ring_map) if (sc->nge_rdata.nge_rx_ring_paddr)
bus_dmamap_unload(sc->nge_cdata.nge_rx_ring_tag, bus_dmamap_unload(sc->nge_cdata.nge_rx_ring_tag,
sc->nge_cdata.nge_rx_ring_map); sc->nge_cdata.nge_rx_ring_map);
if (sc->nge_cdata.nge_rx_ring_map && if (sc->nge_rdata.nge_rx_ring)
sc->nge_rdata.nge_rx_ring)
bus_dmamem_free(sc->nge_cdata.nge_rx_ring_tag, bus_dmamem_free(sc->nge_cdata.nge_rx_ring_tag,
sc->nge_rdata.nge_rx_ring, sc->nge_rdata.nge_rx_ring,
sc->nge_cdata.nge_rx_ring_map); sc->nge_cdata.nge_rx_ring_map);
sc->nge_rdata.nge_rx_ring = NULL; sc->nge_rdata.nge_rx_ring = NULL;
sc->nge_cdata.nge_rx_ring_map = NULL; sc->nge_rdata.nge_rx_ring_paddr = 0;
bus_dma_tag_destroy(sc->nge_cdata.nge_rx_ring_tag); bus_dma_tag_destroy(sc->nge_cdata.nge_rx_ring_tag);
sc->nge_cdata.nge_rx_ring_tag = NULL; sc->nge_cdata.nge_rx_ring_tag = NULL;
} }

View File

@ -1818,10 +1818,10 @@ re_detach(device_t dev)
/* Unload and free the RX DMA ring memory and map */ /* Unload and free the RX DMA ring memory and map */
if (sc->rl_ldata.rl_rx_list_tag) { if (sc->rl_ldata.rl_rx_list_tag) {
if (sc->rl_ldata.rl_rx_list_map) if (sc->rl_ldata.rl_rx_list_addr)
bus_dmamap_unload(sc->rl_ldata.rl_rx_list_tag, bus_dmamap_unload(sc->rl_ldata.rl_rx_list_tag,
sc->rl_ldata.rl_rx_list_map); sc->rl_ldata.rl_rx_list_map);
if (sc->rl_ldata.rl_rx_list_map && sc->rl_ldata.rl_rx_list) if (sc->rl_ldata.rl_rx_list)
bus_dmamem_free(sc->rl_ldata.rl_rx_list_tag, bus_dmamem_free(sc->rl_ldata.rl_rx_list_tag,
sc->rl_ldata.rl_rx_list, sc->rl_ldata.rl_rx_list,
sc->rl_ldata.rl_rx_list_map); sc->rl_ldata.rl_rx_list_map);
@ -1831,10 +1831,10 @@ re_detach(device_t dev)
/* Unload and free the TX DMA ring memory and map */ /* Unload and free the TX DMA ring memory and map */
if (sc->rl_ldata.rl_tx_list_tag) { if (sc->rl_ldata.rl_tx_list_tag) {
if (sc->rl_ldata.rl_tx_list_map) if (sc->rl_ldata.rl_tx_list_addr)
bus_dmamap_unload(sc->rl_ldata.rl_tx_list_tag, bus_dmamap_unload(sc->rl_ldata.rl_tx_list_tag,
sc->rl_ldata.rl_tx_list_map); sc->rl_ldata.rl_tx_list_map);
if (sc->rl_ldata.rl_tx_list_map && sc->rl_ldata.rl_tx_list) if (sc->rl_ldata.rl_tx_list)
bus_dmamem_free(sc->rl_ldata.rl_tx_list_tag, bus_dmamem_free(sc->rl_ldata.rl_tx_list_tag,
sc->rl_ldata.rl_tx_list, sc->rl_ldata.rl_tx_list,
sc->rl_ldata.rl_tx_list_map); sc->rl_ldata.rl_tx_list_map);
@ -1876,10 +1876,10 @@ re_detach(device_t dev)
/* Unload and free the stats buffer and map */ /* Unload and free the stats buffer and map */
if (sc->rl_ldata.rl_stag) { if (sc->rl_ldata.rl_stag) {
if (sc->rl_ldata.rl_smap) if (sc->rl_ldata.rl_stats_addr)
bus_dmamap_unload(sc->rl_ldata.rl_stag, bus_dmamap_unload(sc->rl_ldata.rl_stag,
sc->rl_ldata.rl_smap); sc->rl_ldata.rl_smap);
if (sc->rl_ldata.rl_smap && sc->rl_ldata.rl_stats) if (sc->rl_ldata.rl_stats)
bus_dmamem_free(sc->rl_ldata.rl_stag, bus_dmamem_free(sc->rl_ldata.rl_stag,
sc->rl_ldata.rl_stats, sc->rl_ldata.rl_smap); sc->rl_ldata.rl_stats, sc->rl_ldata.rl_smap);
bus_dma_tag_destroy(sc->rl_ldata.rl_stag); bus_dma_tag_destroy(sc->rl_ldata.rl_stag);

View File

@ -1292,61 +1292,57 @@ sf_dma_free(struct sf_softc *sc)
/* Tx ring. */ /* Tx ring. */
if (sc->sf_cdata.sf_tx_ring_tag) { if (sc->sf_cdata.sf_tx_ring_tag) {
if (sc->sf_cdata.sf_tx_ring_map) if (sc->sf_rdata.sf_tx_ring_paddr)
bus_dmamap_unload(sc->sf_cdata.sf_tx_ring_tag, bus_dmamap_unload(sc->sf_cdata.sf_tx_ring_tag,
sc->sf_cdata.sf_tx_ring_map); sc->sf_cdata.sf_tx_ring_map);
if (sc->sf_cdata.sf_tx_ring_map && if (sc->sf_rdata.sf_tx_ring)
sc->sf_rdata.sf_tx_ring)
bus_dmamem_free(sc->sf_cdata.sf_tx_ring_tag, bus_dmamem_free(sc->sf_cdata.sf_tx_ring_tag,
sc->sf_rdata.sf_tx_ring, sc->sf_rdata.sf_tx_ring,
sc->sf_cdata.sf_tx_ring_map); sc->sf_cdata.sf_tx_ring_map);
sc->sf_rdata.sf_tx_ring = NULL; sc->sf_rdata.sf_tx_ring = NULL;
sc->sf_cdata.sf_tx_ring_map = NULL; sc->sf_rdata.sf_tx_ring_paddr = 0;
bus_dma_tag_destroy(sc->sf_cdata.sf_tx_ring_tag); bus_dma_tag_destroy(sc->sf_cdata.sf_tx_ring_tag);
sc->sf_cdata.sf_tx_ring_tag = NULL; sc->sf_cdata.sf_tx_ring_tag = NULL;
} }
/* Tx completion ring. */ /* Tx completion ring. */
if (sc->sf_cdata.sf_tx_cring_tag) { if (sc->sf_cdata.sf_tx_cring_tag) {
if (sc->sf_cdata.sf_tx_cring_map) if (sc->sf_rdata.sf_tx_cring_paddr)
bus_dmamap_unload(sc->sf_cdata.sf_tx_cring_tag, bus_dmamap_unload(sc->sf_cdata.sf_tx_cring_tag,
sc->sf_cdata.sf_tx_cring_map); sc->sf_cdata.sf_tx_cring_map);
if (sc->sf_cdata.sf_tx_cring_map && if (sc->sf_rdata.sf_tx_cring)
sc->sf_rdata.sf_tx_cring)
bus_dmamem_free(sc->sf_cdata.sf_tx_cring_tag, bus_dmamem_free(sc->sf_cdata.sf_tx_cring_tag,
sc->sf_rdata.sf_tx_cring, sc->sf_rdata.sf_tx_cring,
sc->sf_cdata.sf_tx_cring_map); sc->sf_cdata.sf_tx_cring_map);
sc->sf_rdata.sf_tx_cring = NULL; sc->sf_rdata.sf_tx_cring = NULL;
sc->sf_cdata.sf_tx_cring_map = NULL; sc->sf_rdata.sf_tx_cring_paddr = 0;
bus_dma_tag_destroy(sc->sf_cdata.sf_tx_cring_tag); bus_dma_tag_destroy(sc->sf_cdata.sf_tx_cring_tag);
sc->sf_cdata.sf_tx_cring_tag = NULL; sc->sf_cdata.sf_tx_cring_tag = NULL;
} }
/* Rx ring. */ /* Rx ring. */
if (sc->sf_cdata.sf_rx_ring_tag) { if (sc->sf_cdata.sf_rx_ring_tag) {
if (sc->sf_cdata.sf_rx_ring_map) if (sc->sf_rdata.sf_rx_ring_paddr)
bus_dmamap_unload(sc->sf_cdata.sf_rx_ring_tag, bus_dmamap_unload(sc->sf_cdata.sf_rx_ring_tag,
sc->sf_cdata.sf_rx_ring_map); sc->sf_cdata.sf_rx_ring_map);
if (sc->sf_cdata.sf_rx_ring_map && if (sc->sf_rdata.sf_rx_ring)
sc->sf_rdata.sf_rx_ring)
bus_dmamem_free(sc->sf_cdata.sf_rx_ring_tag, bus_dmamem_free(sc->sf_cdata.sf_rx_ring_tag,
sc->sf_rdata.sf_rx_ring, sc->sf_rdata.sf_rx_ring,
sc->sf_cdata.sf_rx_ring_map); sc->sf_cdata.sf_rx_ring_map);
sc->sf_rdata.sf_rx_ring = NULL; sc->sf_rdata.sf_rx_ring = NULL;
sc->sf_cdata.sf_rx_ring_map = NULL; sc->sf_rdata.sf_rx_ring_paddr = 0;
bus_dma_tag_destroy(sc->sf_cdata.sf_rx_ring_tag); bus_dma_tag_destroy(sc->sf_cdata.sf_rx_ring_tag);
sc->sf_cdata.sf_rx_ring_tag = NULL; sc->sf_cdata.sf_rx_ring_tag = NULL;
} }
/* Rx completion ring. */ /* Rx completion ring. */
if (sc->sf_cdata.sf_rx_cring_tag) { if (sc->sf_cdata.sf_rx_cring_tag) {
if (sc->sf_cdata.sf_rx_cring_map) if (sc->sf_rdata.sf_rx_cring_paddr)
bus_dmamap_unload(sc->sf_cdata.sf_rx_cring_tag, bus_dmamap_unload(sc->sf_cdata.sf_rx_cring_tag,
sc->sf_cdata.sf_rx_cring_map); sc->sf_cdata.sf_rx_cring_map);
if (sc->sf_cdata.sf_rx_cring_map && if (sc->sf_rdata.sf_rx_cring)
sc->sf_rdata.sf_rx_cring)
bus_dmamem_free(sc->sf_cdata.sf_rx_cring_tag, bus_dmamem_free(sc->sf_cdata.sf_rx_cring_tag,
sc->sf_rdata.sf_rx_cring, sc->sf_rdata.sf_rx_cring,
sc->sf_cdata.sf_rx_cring_map); sc->sf_cdata.sf_rx_cring_map);
sc->sf_rdata.sf_rx_cring = NULL; sc->sf_rdata.sf_rx_cring = NULL;
sc->sf_cdata.sf_rx_cring_map = NULL; sc->sf_rdata.sf_rx_cring_paddr = 0;
bus_dma_tag_destroy(sc->sf_cdata.sf_rx_cring_tag); bus_dma_tag_destroy(sc->sf_cdata.sf_rx_cring_tag);
sc->sf_cdata.sf_rx_cring_tag = NULL; sc->sf_cdata.sf_rx_cring_tag = NULL;
} }

View File

@ -916,25 +916,25 @@ sge_dma_free(struct sge_softc *sc)
ld = &sc->sge_ldata; ld = &sc->sge_ldata;
/* Rx ring. */ /* Rx ring. */
if (cd->sge_rx_tag != NULL) { if (cd->sge_rx_tag != NULL) {
if (cd->sge_rx_dmamap != NULL) if (ld->sge_rx_paddr != 0)
bus_dmamap_unload(cd->sge_rx_tag, cd->sge_rx_dmamap); bus_dmamap_unload(cd->sge_rx_tag, cd->sge_rx_dmamap);
if (cd->sge_rx_dmamap != NULL && ld->sge_rx_ring != NULL) if (ld->sge_rx_ring != NULL)
bus_dmamem_free(cd->sge_rx_tag, ld->sge_rx_ring, bus_dmamem_free(cd->sge_rx_tag, ld->sge_rx_ring,
cd->sge_rx_dmamap); cd->sge_rx_dmamap);
ld->sge_rx_ring = NULL; ld->sge_rx_ring = NULL;
cd->sge_rx_dmamap = NULL; ld->sge_rx_paddr = 0;
bus_dma_tag_destroy(cd->sge_rx_tag); bus_dma_tag_destroy(cd->sge_rx_tag);
cd->sge_rx_tag = NULL; cd->sge_rx_tag = NULL;
} }
/* Tx ring. */ /* Tx ring. */
if (cd->sge_tx_tag != NULL) { if (cd->sge_tx_tag != NULL) {
if (cd->sge_tx_dmamap != NULL) if (ld->sge_tx_paddr != 0)
bus_dmamap_unload(cd->sge_tx_tag, cd->sge_tx_dmamap); bus_dmamap_unload(cd->sge_tx_tag, cd->sge_tx_dmamap);
if (cd->sge_tx_dmamap != NULL && ld->sge_tx_ring != NULL) if (ld->sge_tx_ring != NULL)
bus_dmamem_free(cd->sge_tx_tag, ld->sge_tx_ring, bus_dmamem_free(cd->sge_tx_tag, ld->sge_tx_ring,
cd->sge_tx_dmamap); cd->sge_tx_dmamap);
ld->sge_tx_ring = NULL; ld->sge_tx_ring = NULL;
cd->sge_tx_dmamap = NULL; ld->sge_tx_paddr = 0;
bus_dma_tag_destroy(cd->sge_tx_tag); bus_dma_tag_destroy(cd->sge_tx_tag);
cd->sge_tx_tag = NULL; cd->sge_tx_tag = NULL;
} }

View File

@ -1329,9 +1329,9 @@ sis_dma_free(struct sis_softc *sc)
bus_dma_tag_destroy(sc->sis_tx_tag); bus_dma_tag_destroy(sc->sis_tx_tag);
/* Destroy RX ring. */ /* Destroy RX ring. */
if (sc->sis_rx_list_map) if (sc->sis_rx_paddr)
bus_dmamap_unload(sc->sis_rx_list_tag, sc->sis_rx_list_map); bus_dmamap_unload(sc->sis_rx_list_tag, sc->sis_rx_list_map);
if (sc->sis_rx_list_map && sc->sis_rx_list) if (sc->sis_rx_list)
bus_dmamem_free(sc->sis_rx_list_tag, sc->sis_rx_list, bus_dmamem_free(sc->sis_rx_list_tag, sc->sis_rx_list,
sc->sis_rx_list_map); sc->sis_rx_list_map);
@ -1339,10 +1339,10 @@ sis_dma_free(struct sis_softc *sc)
bus_dma_tag_destroy(sc->sis_rx_list_tag); bus_dma_tag_destroy(sc->sis_rx_list_tag);
/* Destroy TX ring. */ /* Destroy TX ring. */
if (sc->sis_tx_list_map) if (sc->sis_tx_paddr)
bus_dmamap_unload(sc->sis_tx_list_tag, sc->sis_tx_list_map); bus_dmamap_unload(sc->sis_tx_list_tag, sc->sis_tx_list_map);
if (sc->sis_tx_list_map && sc->sis_tx_list) if (sc->sis_tx_list)
bus_dmamem_free(sc->sis_tx_list_tag, sc->sis_tx_list, bus_dmamem_free(sc->sis_tx_list_tag, sc->sis_tx_list,
sc->sis_tx_list_map); sc->sis_tx_list_map);

View File

@ -2223,31 +2223,29 @@ sk_dma_free(sc_if)
/* Tx ring */ /* Tx ring */
if (sc_if->sk_cdata.sk_tx_ring_tag) { if (sc_if->sk_cdata.sk_tx_ring_tag) {
if (sc_if->sk_cdata.sk_tx_ring_map) if (sc_if->sk_rdata.sk_tx_ring_paddr)
bus_dmamap_unload(sc_if->sk_cdata.sk_tx_ring_tag, bus_dmamap_unload(sc_if->sk_cdata.sk_tx_ring_tag,
sc_if->sk_cdata.sk_tx_ring_map); sc_if->sk_cdata.sk_tx_ring_map);
if (sc_if->sk_cdata.sk_tx_ring_map && if (sc_if->sk_rdata.sk_tx_ring)
sc_if->sk_rdata.sk_tx_ring)
bus_dmamem_free(sc_if->sk_cdata.sk_tx_ring_tag, bus_dmamem_free(sc_if->sk_cdata.sk_tx_ring_tag,
sc_if->sk_rdata.sk_tx_ring, sc_if->sk_rdata.sk_tx_ring,
sc_if->sk_cdata.sk_tx_ring_map); sc_if->sk_cdata.sk_tx_ring_map);
sc_if->sk_rdata.sk_tx_ring = NULL; sc_if->sk_rdata.sk_tx_ring = NULL;
sc_if->sk_cdata.sk_tx_ring_map = NULL; sc_if->sk_rdata.sk_tx_ring_paddr = 0;
bus_dma_tag_destroy(sc_if->sk_cdata.sk_tx_ring_tag); bus_dma_tag_destroy(sc_if->sk_cdata.sk_tx_ring_tag);
sc_if->sk_cdata.sk_tx_ring_tag = NULL; sc_if->sk_cdata.sk_tx_ring_tag = NULL;
} }
/* Rx ring */ /* Rx ring */
if (sc_if->sk_cdata.sk_rx_ring_tag) { if (sc_if->sk_cdata.sk_rx_ring_tag) {
if (sc_if->sk_cdata.sk_rx_ring_map) if (sc_if->sk_rdata.sk_rx_ring_paddr)
bus_dmamap_unload(sc_if->sk_cdata.sk_rx_ring_tag, bus_dmamap_unload(sc_if->sk_cdata.sk_rx_ring_tag,
sc_if->sk_cdata.sk_rx_ring_map); sc_if->sk_cdata.sk_rx_ring_map);
if (sc_if->sk_cdata.sk_rx_ring_map && if (sc_if->sk_rdata.sk_rx_ring)
sc_if->sk_rdata.sk_rx_ring)
bus_dmamem_free(sc_if->sk_cdata.sk_rx_ring_tag, bus_dmamem_free(sc_if->sk_cdata.sk_rx_ring_tag,
sc_if->sk_rdata.sk_rx_ring, sc_if->sk_rdata.sk_rx_ring,
sc_if->sk_cdata.sk_rx_ring_map); sc_if->sk_cdata.sk_rx_ring_map);
sc_if->sk_rdata.sk_rx_ring = NULL; sc_if->sk_rdata.sk_rx_ring = NULL;
sc_if->sk_cdata.sk_rx_ring_map = NULL; sc_if->sk_rdata.sk_rx_ring_paddr = 0;
bus_dma_tag_destroy(sc_if->sk_cdata.sk_rx_ring_tag); bus_dma_tag_destroy(sc_if->sk_cdata.sk_rx_ring_tag);
sc_if->sk_cdata.sk_rx_ring_tag = NULL; sc_if->sk_cdata.sk_rx_ring_tag = NULL;
} }
@ -2298,16 +2296,15 @@ sk_dma_jumbo_free(sc_if)
/* jumbo Rx ring */ /* jumbo Rx ring */
if (sc_if->sk_cdata.sk_jumbo_rx_ring_tag) { if (sc_if->sk_cdata.sk_jumbo_rx_ring_tag) {
if (sc_if->sk_cdata.sk_jumbo_rx_ring_map) if (sc_if->sk_rdata.sk_jumbo_rx_ring_paddr)
bus_dmamap_unload(sc_if->sk_cdata.sk_jumbo_rx_ring_tag, bus_dmamap_unload(sc_if->sk_cdata.sk_jumbo_rx_ring_tag,
sc_if->sk_cdata.sk_jumbo_rx_ring_map); sc_if->sk_cdata.sk_jumbo_rx_ring_map);
if (sc_if->sk_cdata.sk_jumbo_rx_ring_map && if (sc_if->sk_rdata.sk_jumbo_rx_ring)
sc_if->sk_rdata.sk_jumbo_rx_ring)
bus_dmamem_free(sc_if->sk_cdata.sk_jumbo_rx_ring_tag, bus_dmamem_free(sc_if->sk_cdata.sk_jumbo_rx_ring_tag,
sc_if->sk_rdata.sk_jumbo_rx_ring, sc_if->sk_rdata.sk_jumbo_rx_ring,
sc_if->sk_cdata.sk_jumbo_rx_ring_map); sc_if->sk_cdata.sk_jumbo_rx_ring_map);
sc_if->sk_rdata.sk_jumbo_rx_ring = NULL; sc_if->sk_rdata.sk_jumbo_rx_ring = NULL;
sc_if->sk_cdata.sk_jumbo_rx_ring_map = NULL; sc_if->sk_rdata.sk_jumbo_rx_ring_paddr = 0;
bus_dma_tag_destroy(sc_if->sk_cdata.sk_jumbo_rx_ring_tag); bus_dma_tag_destroy(sc_if->sk_cdata.sk_jumbo_rx_ring_tag);
sc_if->sk_cdata.sk_jumbo_rx_ring_tag = NULL; sc_if->sk_cdata.sk_jumbo_rx_ring_tag = NULL;
} }

View File

@ -1344,31 +1344,29 @@ ste_dma_free(struct ste_softc *sc)
} }
/* Tx descriptor list. */ /* Tx descriptor list. */
if (sc->ste_cdata.ste_tx_list_tag != NULL) { if (sc->ste_cdata.ste_tx_list_tag != NULL) {
if (sc->ste_cdata.ste_tx_list_map != NULL) if (sc->ste_ldata.ste_tx_list_paddr != 0)
bus_dmamap_unload(sc->ste_cdata.ste_tx_list_tag, bus_dmamap_unload(sc->ste_cdata.ste_tx_list_tag,
sc->ste_cdata.ste_tx_list_map); sc->ste_cdata.ste_tx_list_map);
if (sc->ste_cdata.ste_tx_list_map != NULL && if (sc->ste_ldata.ste_tx_list != NULL)
sc->ste_ldata.ste_tx_list != NULL)
bus_dmamem_free(sc->ste_cdata.ste_tx_list_tag, bus_dmamem_free(sc->ste_cdata.ste_tx_list_tag,
sc->ste_ldata.ste_tx_list, sc->ste_ldata.ste_tx_list,
sc->ste_cdata.ste_tx_list_map); sc->ste_cdata.ste_tx_list_map);
sc->ste_ldata.ste_tx_list = NULL; sc->ste_ldata.ste_tx_list = NULL;
sc->ste_cdata.ste_tx_list_map = NULL; sc->ste_ldata.ste_tx_list_paddr = 0;
bus_dma_tag_destroy(sc->ste_cdata.ste_tx_list_tag); bus_dma_tag_destroy(sc->ste_cdata.ste_tx_list_tag);
sc->ste_cdata.ste_tx_list_tag = NULL; sc->ste_cdata.ste_tx_list_tag = NULL;
} }
/* Rx descriptor list. */ /* Rx descriptor list. */
if (sc->ste_cdata.ste_rx_list_tag != NULL) { if (sc->ste_cdata.ste_rx_list_tag != NULL) {
if (sc->ste_cdata.ste_rx_list_map != NULL) if (sc->ste_ldata.ste_rx_list_paddr != 0)
bus_dmamap_unload(sc->ste_cdata.ste_rx_list_tag, bus_dmamap_unload(sc->ste_cdata.ste_rx_list_tag,
sc->ste_cdata.ste_rx_list_map); sc->ste_cdata.ste_rx_list_map);
if (sc->ste_cdata.ste_rx_list_map != NULL && if (sc->ste_ldata.ste_rx_list != NULL)
sc->ste_ldata.ste_rx_list != NULL)
bus_dmamem_free(sc->ste_cdata.ste_rx_list_tag, bus_dmamem_free(sc->ste_cdata.ste_rx_list_tag,
sc->ste_ldata.ste_rx_list, sc->ste_ldata.ste_rx_list,
sc->ste_cdata.ste_rx_list_map); sc->ste_cdata.ste_rx_list_map);
sc->ste_ldata.ste_rx_list = NULL; sc->ste_ldata.ste_rx_list = NULL;
sc->ste_cdata.ste_rx_list_map = NULL; sc->ste_ldata.ste_rx_list_paddr = 0;
bus_dma_tag_destroy(sc->ste_cdata.ste_rx_list_tag); bus_dma_tag_destroy(sc->ste_cdata.ste_rx_list_tag);
sc->ste_cdata.ste_rx_list_tag = NULL; sc->ste_cdata.ste_rx_list_tag = NULL;
} }

View File

@ -902,31 +902,29 @@ stge_dma_free(struct stge_softc *sc)
/* Tx ring */ /* Tx ring */
if (sc->sc_cdata.stge_tx_ring_tag) { if (sc->sc_cdata.stge_tx_ring_tag) {
if (sc->sc_cdata.stge_tx_ring_map) if (sc->sc_rdata.stge_tx_ring_paddr)
bus_dmamap_unload(sc->sc_cdata.stge_tx_ring_tag, bus_dmamap_unload(sc->sc_cdata.stge_tx_ring_tag,
sc->sc_cdata.stge_tx_ring_map); sc->sc_cdata.stge_tx_ring_map);
if (sc->sc_cdata.stge_tx_ring_map && if (sc->sc_rdata.stge_tx_ring)
sc->sc_rdata.stge_tx_ring)
bus_dmamem_free(sc->sc_cdata.stge_tx_ring_tag, bus_dmamem_free(sc->sc_cdata.stge_tx_ring_tag,
sc->sc_rdata.stge_tx_ring, sc->sc_rdata.stge_tx_ring,
sc->sc_cdata.stge_tx_ring_map); sc->sc_cdata.stge_tx_ring_map);
sc->sc_rdata.stge_tx_ring = NULL; sc->sc_rdata.stge_tx_ring = NULL;
sc->sc_cdata.stge_tx_ring_map = 0; sc->sc_rdata.stge_tx_ring_paddr = 0;
bus_dma_tag_destroy(sc->sc_cdata.stge_tx_ring_tag); bus_dma_tag_destroy(sc->sc_cdata.stge_tx_ring_tag);
sc->sc_cdata.stge_tx_ring_tag = NULL; sc->sc_cdata.stge_tx_ring_tag = NULL;
} }
/* Rx ring */ /* Rx ring */
if (sc->sc_cdata.stge_rx_ring_tag) { if (sc->sc_cdata.stge_rx_ring_tag) {
if (sc->sc_cdata.stge_rx_ring_map) if (sc->sc_rdata.stge_rx_ring_paddr)
bus_dmamap_unload(sc->sc_cdata.stge_rx_ring_tag, bus_dmamap_unload(sc->sc_cdata.stge_rx_ring_tag,
sc->sc_cdata.stge_rx_ring_map); sc->sc_cdata.stge_rx_ring_map);
if (sc->sc_cdata.stge_rx_ring_map && if (sc->sc_rdata.stge_rx_ring)
sc->sc_rdata.stge_rx_ring)
bus_dmamem_free(sc->sc_cdata.stge_rx_ring_tag, bus_dmamem_free(sc->sc_cdata.stge_rx_ring_tag,
sc->sc_rdata.stge_rx_ring, sc->sc_rdata.stge_rx_ring,
sc->sc_cdata.stge_rx_ring_map); sc->sc_cdata.stge_rx_ring_map);
sc->sc_rdata.stge_rx_ring = NULL; sc->sc_rdata.stge_rx_ring = NULL;
sc->sc_cdata.stge_rx_ring_map = 0; sc->sc_rdata.stge_rx_ring_paddr = 0;
bus_dma_tag_destroy(sc->sc_cdata.stge_rx_ring_tag); bus_dma_tag_destroy(sc->sc_cdata.stge_rx_ring_tag);
sc->sc_cdata.stge_rx_ring_tag = NULL; sc->sc_cdata.stge_rx_ring_tag = NULL;
} }

View File

@ -912,31 +912,29 @@ vge_dma_free(struct vge_softc *sc)
/* Tx ring. */ /* Tx ring. */
if (sc->vge_cdata.vge_tx_ring_tag != NULL) { if (sc->vge_cdata.vge_tx_ring_tag != NULL) {
if (sc->vge_cdata.vge_tx_ring_map) if (sc->vge_rdata.vge_tx_ring_paddr)
bus_dmamap_unload(sc->vge_cdata.vge_tx_ring_tag, bus_dmamap_unload(sc->vge_cdata.vge_tx_ring_tag,
sc->vge_cdata.vge_tx_ring_map); sc->vge_cdata.vge_tx_ring_map);
if (sc->vge_cdata.vge_tx_ring_map && if (sc->vge_rdata.vge_tx_ring)
sc->vge_rdata.vge_tx_ring)
bus_dmamem_free(sc->vge_cdata.vge_tx_ring_tag, bus_dmamem_free(sc->vge_cdata.vge_tx_ring_tag,
sc->vge_rdata.vge_tx_ring, sc->vge_rdata.vge_tx_ring,
sc->vge_cdata.vge_tx_ring_map); sc->vge_cdata.vge_tx_ring_map);
sc->vge_rdata.vge_tx_ring = NULL; sc->vge_rdata.vge_tx_ring = NULL;
sc->vge_cdata.vge_tx_ring_map = NULL; sc->vge_rdata.vge_tx_ring_paddr = 0;
bus_dma_tag_destroy(sc->vge_cdata.vge_tx_ring_tag); bus_dma_tag_destroy(sc->vge_cdata.vge_tx_ring_tag);
sc->vge_cdata.vge_tx_ring_tag = NULL; sc->vge_cdata.vge_tx_ring_tag = NULL;
} }
/* Rx ring. */ /* Rx ring. */
if (sc->vge_cdata.vge_rx_ring_tag != NULL) { if (sc->vge_cdata.vge_rx_ring_tag != NULL) {
if (sc->vge_cdata.vge_rx_ring_map) if (sc->vge_rdata.vge_rx_ring_paddr)
bus_dmamap_unload(sc->vge_cdata.vge_rx_ring_tag, bus_dmamap_unload(sc->vge_cdata.vge_rx_ring_tag,
sc->vge_cdata.vge_rx_ring_map); sc->vge_cdata.vge_rx_ring_map);
if (sc->vge_cdata.vge_rx_ring_map && if (sc->vge_rdata.vge_rx_ring)
sc->vge_rdata.vge_rx_ring)
bus_dmamem_free(sc->vge_cdata.vge_rx_ring_tag, bus_dmamem_free(sc->vge_cdata.vge_rx_ring_tag,
sc->vge_rdata.vge_rx_ring, sc->vge_rdata.vge_rx_ring,
sc->vge_cdata.vge_rx_ring_map); sc->vge_cdata.vge_rx_ring_map);
sc->vge_rdata.vge_rx_ring = NULL; sc->vge_rdata.vge_rx_ring = NULL;
sc->vge_cdata.vge_rx_ring_map = NULL; sc->vge_rdata.vge_rx_ring_paddr = 0;
bus_dma_tag_destroy(sc->vge_cdata.vge_rx_ring_tag); bus_dma_tag_destroy(sc->vge_cdata.vge_rx_ring_tag);
sc->vge_cdata.vge_rx_ring_tag = NULL; sc->vge_cdata.vge_rx_ring_tag = NULL;
} }

View File

@ -1060,31 +1060,29 @@ vr_dma_free(struct vr_softc *sc)
/* Tx ring. */ /* Tx ring. */
if (sc->vr_cdata.vr_tx_ring_tag) { if (sc->vr_cdata.vr_tx_ring_tag) {
if (sc->vr_cdata.vr_tx_ring_map) if (sc->vr_rdata.vr_tx_ring_paddr)
bus_dmamap_unload(sc->vr_cdata.vr_tx_ring_tag, bus_dmamap_unload(sc->vr_cdata.vr_tx_ring_tag,
sc->vr_cdata.vr_tx_ring_map); sc->vr_cdata.vr_tx_ring_map);
if (sc->vr_cdata.vr_tx_ring_map && if (sc->vr_rdata.vr_tx_ring)
sc->vr_rdata.vr_tx_ring)
bus_dmamem_free(sc->vr_cdata.vr_tx_ring_tag, bus_dmamem_free(sc->vr_cdata.vr_tx_ring_tag,
sc->vr_rdata.vr_tx_ring, sc->vr_rdata.vr_tx_ring,
sc->vr_cdata.vr_tx_ring_map); sc->vr_cdata.vr_tx_ring_map);
sc->vr_rdata.vr_tx_ring = NULL; sc->vr_rdata.vr_tx_ring = NULL;
sc->vr_cdata.vr_tx_ring_map = NULL; sc->vr_rdata.vr_tx_ring_paddr = 0;
bus_dma_tag_destroy(sc->vr_cdata.vr_tx_ring_tag); bus_dma_tag_destroy(sc->vr_cdata.vr_tx_ring_tag);
sc->vr_cdata.vr_tx_ring_tag = NULL; sc->vr_cdata.vr_tx_ring_tag = NULL;
} }
/* Rx ring. */ /* Rx ring. */
if (sc->vr_cdata.vr_rx_ring_tag) { if (sc->vr_cdata.vr_rx_ring_tag) {
if (sc->vr_cdata.vr_rx_ring_map) if (sc->vr_rdata.vr_rx_ring_paddr)
bus_dmamap_unload(sc->vr_cdata.vr_rx_ring_tag, bus_dmamap_unload(sc->vr_cdata.vr_rx_ring_tag,
sc->vr_cdata.vr_rx_ring_map); sc->vr_cdata.vr_rx_ring_map);
if (sc->vr_cdata.vr_rx_ring_map && if (sc->vr_rdata.vr_rx_ring)
sc->vr_rdata.vr_rx_ring)
bus_dmamem_free(sc->vr_cdata.vr_rx_ring_tag, bus_dmamem_free(sc->vr_cdata.vr_rx_ring_tag,
sc->vr_rdata.vr_rx_ring, sc->vr_rdata.vr_rx_ring,
sc->vr_cdata.vr_rx_ring_map); sc->vr_cdata.vr_rx_ring_map);
sc->vr_rdata.vr_rx_ring = NULL; sc->vr_rdata.vr_rx_ring = NULL;
sc->vr_cdata.vr_rx_ring_map = NULL; sc->vr_rdata.vr_rx_ring_paddr = 0;
bus_dma_tag_destroy(sc->vr_cdata.vr_rx_ring_tag); bus_dma_tag_destroy(sc->vr_cdata.vr_rx_ring_tag);
sc->vr_cdata.vr_rx_ring_tag = NULL; sc->vr_cdata.vr_rx_ring_tag = NULL;
} }

View File

@ -892,31 +892,29 @@ vte_dma_free(struct vte_softc *sc)
} }
/* TX descriptor ring. */ /* TX descriptor ring. */
if (sc->vte_cdata.vte_tx_ring_tag != NULL) { if (sc->vte_cdata.vte_tx_ring_tag != NULL) {
if (sc->vte_cdata.vte_tx_ring_map != NULL) if (sc->vte_cdata.vte_tx_ring_paddr != 0)
bus_dmamap_unload(sc->vte_cdata.vte_tx_ring_tag, bus_dmamap_unload(sc->vte_cdata.vte_tx_ring_tag,
sc->vte_cdata.vte_tx_ring_map); sc->vte_cdata.vte_tx_ring_map);
if (sc->vte_cdata.vte_tx_ring_map != NULL && if (sc->vte_cdata.vte_tx_ring != NULL)
sc->vte_cdata.vte_tx_ring != NULL)
bus_dmamem_free(sc->vte_cdata.vte_tx_ring_tag, bus_dmamem_free(sc->vte_cdata.vte_tx_ring_tag,
sc->vte_cdata.vte_tx_ring, sc->vte_cdata.vte_tx_ring,
sc->vte_cdata.vte_tx_ring_map); sc->vte_cdata.vte_tx_ring_map);
sc->vte_cdata.vte_tx_ring = NULL; sc->vte_cdata.vte_tx_ring = NULL;
sc->vte_cdata.vte_tx_ring_map = NULL; sc->vte_cdata.vte_tx_ring_paddr = 0;
bus_dma_tag_destroy(sc->vte_cdata.vte_tx_ring_tag); bus_dma_tag_destroy(sc->vte_cdata.vte_tx_ring_tag);
sc->vte_cdata.vte_tx_ring_tag = NULL; sc->vte_cdata.vte_tx_ring_tag = NULL;
} }
/* RX ring. */ /* RX ring. */
if (sc->vte_cdata.vte_rx_ring_tag != NULL) { if (sc->vte_cdata.vte_rx_ring_tag != NULL) {
if (sc->vte_cdata.vte_rx_ring_map != NULL) if (sc->vte_cdata.vte_rx_ring_paddr != 0)
bus_dmamap_unload(sc->vte_cdata.vte_rx_ring_tag, bus_dmamap_unload(sc->vte_cdata.vte_rx_ring_tag,
sc->vte_cdata.vte_rx_ring_map); sc->vte_cdata.vte_rx_ring_map);
if (sc->vte_cdata.vte_rx_ring_map != NULL && if (sc->vte_cdata.vte_rx_ring != NULL)
sc->vte_cdata.vte_rx_ring != NULL)
bus_dmamem_free(sc->vte_cdata.vte_rx_ring_tag, bus_dmamem_free(sc->vte_cdata.vte_rx_ring_tag,
sc->vte_cdata.vte_rx_ring, sc->vte_cdata.vte_rx_ring,
sc->vte_cdata.vte_rx_ring_map); sc->vte_cdata.vte_rx_ring_map);
sc->vte_cdata.vte_rx_ring = NULL; sc->vte_cdata.vte_rx_ring = NULL;
sc->vte_cdata.vte_rx_ring_map = NULL; sc->vte_cdata.vte_rx_ring_paddr = 0;
bus_dma_tag_destroy(sc->vte_cdata.vte_rx_ring_tag); bus_dma_tag_destroy(sc->vte_cdata.vte_rx_ring_tag);
sc->vte_cdata.vte_rx_ring_tag = NULL; sc->vte_cdata.vte_rx_ring_tag = NULL;
} }

View File

@ -1823,31 +1823,29 @@ arge_dma_free(struct arge_softc *sc)
/* Tx ring. */ /* Tx ring. */
if (sc->arge_cdata.arge_tx_ring_tag) { if (sc->arge_cdata.arge_tx_ring_tag) {
if (sc->arge_cdata.arge_tx_ring_map) if (sc->arge_rdata.arge_tx_ring_paddr)
bus_dmamap_unload(sc->arge_cdata.arge_tx_ring_tag, bus_dmamap_unload(sc->arge_cdata.arge_tx_ring_tag,
sc->arge_cdata.arge_tx_ring_map); sc->arge_cdata.arge_tx_ring_map);
if (sc->arge_cdata.arge_tx_ring_map && if (sc->arge_rdata.arge_tx_ring)
sc->arge_rdata.arge_tx_ring)
bus_dmamem_free(sc->arge_cdata.arge_tx_ring_tag, bus_dmamem_free(sc->arge_cdata.arge_tx_ring_tag,
sc->arge_rdata.arge_tx_ring, sc->arge_rdata.arge_tx_ring,
sc->arge_cdata.arge_tx_ring_map); sc->arge_cdata.arge_tx_ring_map);
sc->arge_rdata.arge_tx_ring = NULL; sc->arge_rdata.arge_tx_ring = NULL;
sc->arge_cdata.arge_tx_ring_map = NULL; sc->arge_rdata.arge_tx_ring_paddr = 0;
bus_dma_tag_destroy(sc->arge_cdata.arge_tx_ring_tag); bus_dma_tag_destroy(sc->arge_cdata.arge_tx_ring_tag);
sc->arge_cdata.arge_tx_ring_tag = NULL; sc->arge_cdata.arge_tx_ring_tag = NULL;
} }
/* Rx ring. */ /* Rx ring. */
if (sc->arge_cdata.arge_rx_ring_tag) { if (sc->arge_cdata.arge_rx_ring_tag) {
if (sc->arge_cdata.arge_rx_ring_map) if (sc->arge_rdata.arge_rx_ring_paddr)
bus_dmamap_unload(sc->arge_cdata.arge_rx_ring_tag, bus_dmamap_unload(sc->arge_cdata.arge_rx_ring_tag,
sc->arge_cdata.arge_rx_ring_map); sc->arge_cdata.arge_rx_ring_map);
if (sc->arge_cdata.arge_rx_ring_map && if (sc->arge_rdata.arge_rx_ring)
sc->arge_rdata.arge_rx_ring)
bus_dmamem_free(sc->arge_cdata.arge_rx_ring_tag, bus_dmamem_free(sc->arge_cdata.arge_rx_ring_tag,
sc->arge_rdata.arge_rx_ring, sc->arge_rdata.arge_rx_ring,
sc->arge_cdata.arge_rx_ring_map); sc->arge_cdata.arge_rx_ring_map);
sc->arge_rdata.arge_rx_ring = NULL; sc->arge_rdata.arge_rx_ring = NULL;
sc->arge_cdata.arge_rx_ring_map = NULL; sc->arge_rdata.arge_rx_ring_paddr = 0;
bus_dma_tag_destroy(sc->arge_cdata.arge_rx_ring_tag); bus_dma_tag_destroy(sc->arge_cdata.arge_rx_ring_tag);
sc->arge_cdata.arge_rx_ring_tag = NULL; sc->arge_cdata.arge_rx_ring_tag = NULL;
} }

View File

@ -1149,31 +1149,29 @@ kr_dma_free(struct kr_softc *sc)
/* Tx ring. */ /* Tx ring. */
if (sc->kr_cdata.kr_tx_ring_tag) { if (sc->kr_cdata.kr_tx_ring_tag) {
if (sc->kr_cdata.kr_tx_ring_map) if (sc->kr_rdata.kr_tx_ring_paddr)
bus_dmamap_unload(sc->kr_cdata.kr_tx_ring_tag, bus_dmamap_unload(sc->kr_cdata.kr_tx_ring_tag,
sc->kr_cdata.kr_tx_ring_map); sc->kr_cdata.kr_tx_ring_map);
if (sc->kr_cdata.kr_tx_ring_map && if (sc->kr_rdata.kr_tx_ring)
sc->kr_rdata.kr_tx_ring)
bus_dmamem_free(sc->kr_cdata.kr_tx_ring_tag, bus_dmamem_free(sc->kr_cdata.kr_tx_ring_tag,
sc->kr_rdata.kr_tx_ring, sc->kr_rdata.kr_tx_ring,
sc->kr_cdata.kr_tx_ring_map); sc->kr_cdata.kr_tx_ring_map);
sc->kr_rdata.kr_tx_ring = NULL; sc->kr_rdata.kr_tx_ring = NULL;
sc->kr_cdata.kr_tx_ring_map = NULL; sc->kr_rdata.kr_tx_ring_paddr = 0;
bus_dma_tag_destroy(sc->kr_cdata.kr_tx_ring_tag); bus_dma_tag_destroy(sc->kr_cdata.kr_tx_ring_tag);
sc->kr_cdata.kr_tx_ring_tag = NULL; sc->kr_cdata.kr_tx_ring_tag = NULL;
} }
/* Rx ring. */ /* Rx ring. */
if (sc->kr_cdata.kr_rx_ring_tag) { if (sc->kr_cdata.kr_rx_ring_tag) {
if (sc->kr_cdata.kr_rx_ring_map) if (sc->kr_rdata.kr_rx_ring_paddr)
bus_dmamap_unload(sc->kr_cdata.kr_rx_ring_tag, bus_dmamap_unload(sc->kr_cdata.kr_rx_ring_tag,
sc->kr_cdata.kr_rx_ring_map); sc->kr_cdata.kr_rx_ring_map);
if (sc->kr_cdata.kr_rx_ring_map && if (sc->kr_rdata.kr_rx_ring)
sc->kr_rdata.kr_rx_ring)
bus_dmamem_free(sc->kr_cdata.kr_rx_ring_tag, bus_dmamem_free(sc->kr_cdata.kr_rx_ring_tag,
sc->kr_rdata.kr_rx_ring, sc->kr_rdata.kr_rx_ring,
sc->kr_cdata.kr_rx_ring_map); sc->kr_cdata.kr_rx_ring_map);
sc->kr_rdata.kr_rx_ring = NULL; sc->kr_rdata.kr_rx_ring = NULL;
sc->kr_cdata.kr_rx_ring_map = NULL; sc->kr_rdata.kr_rx_ring_paddr = 0;
bus_dma_tag_destroy(sc->kr_cdata.kr_rx_ring_tag); bus_dma_tag_destroy(sc->kr_cdata.kr_rx_ring_tag);
sc->kr_cdata.kr_rx_ring_tag = NULL; sc->kr_cdata.kr_rx_ring_tag = NULL;
} }

View File

@ -1018,17 +1018,16 @@ rl_dma_free(struct rl_softc *sc)
/* Rx memory block. */ /* Rx memory block. */
if (sc->rl_cdata.rl_rx_tag != NULL) { if (sc->rl_cdata.rl_rx_tag != NULL) {
if (sc->rl_cdata.rl_rx_dmamap != NULL) if (sc->rl_cdata.rl_rx_buf_paddr != 0)
bus_dmamap_unload(sc->rl_cdata.rl_rx_tag, bus_dmamap_unload(sc->rl_cdata.rl_rx_tag,
sc->rl_cdata.rl_rx_dmamap); sc->rl_cdata.rl_rx_dmamap);
if (sc->rl_cdata.rl_rx_dmamap != NULL && if (sc->rl_cdata.rl_rx_buf_ptr != NULL)
sc->rl_cdata.rl_rx_buf_ptr != NULL)
bus_dmamem_free(sc->rl_cdata.rl_rx_tag, bus_dmamem_free(sc->rl_cdata.rl_rx_tag,
sc->rl_cdata.rl_rx_buf_ptr, sc->rl_cdata.rl_rx_buf_ptr,
sc->rl_cdata.rl_rx_dmamap); sc->rl_cdata.rl_rx_dmamap);
sc->rl_cdata.rl_rx_buf_ptr = NULL; sc->rl_cdata.rl_rx_buf_ptr = NULL;
sc->rl_cdata.rl_rx_buf = NULL; sc->rl_cdata.rl_rx_buf = NULL;
sc->rl_cdata.rl_rx_dmamap = NULL; sc->rl_cdata.rl_rx_buf_paddr = 0;
bus_dma_tag_destroy(sc->rl_cdata.rl_rx_tag); bus_dma_tag_destroy(sc->rl_cdata.rl_rx_tag);
sc->rl_cdata.rl_tx_tag = NULL; sc->rl_cdata.rl_tx_tag = NULL;
} }