summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorNathan Binkert <nate@cvs.openbsd.org>2002-04-26 04:36:39 +0000
committerNathan Binkert <nate@cvs.openbsd.org>2002-04-26 04:36:39 +0000
commit7a73406f17db7b8a068e2dad70e7c2074842bf79 (patch)
treebf1086da517709cfe9aa7eb513fbf002b3bb3d1e /sys/dev
parent1af502855dfc89da4e63fc61e60f0c2dd4d1b555 (diff)
Don't try to destroy a dmamap if the map was never created
This prevents a panic from occuring if the attach fails before the dmamap is created
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_gx.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/dev/pci/if_gx.c b/sys/dev/pci/if_gx.c
index 37ddf04b7e8..4b8363d1755 100644
--- a/sys/dev/pci/if_gx.c
+++ b/sys/dev/pci/if_gx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gx.c,v 1.3 2002/04/17 18:30:45 fgsch Exp $ */
+/* $OpenBSD: if_gx.c,v 1.4 2002/04/26 04:36:38 nate Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon
* All rights reserved.
@@ -498,10 +498,14 @@ gx_release(struct gx_softc *gx)
#endif
for (i = 0; i < GX_RX_RING_CNT; i++)
- bus_dmamap_destroy(gx->gx_dmatag, gx->gx_cdata.gx_rx_map[i]);
+ if (gx->gx_cdata.gx_rx_map[i])
+ bus_dmamap_destroy(gx->gx_dmatag,
+ gx->gx_cdata.gx_rx_map[i]);
for (i = 0; i < GX_TX_RING_CNT; i++)
- bus_dmamap_destroy(gx->gx_dmatag, gx->gx_cdata.gx_tx_map[i]);
+ if (gx->gx_cdata.gx_tx_map[i])
+ bus_dmamap_destroy(gx->gx_dmatag,
+ gx->gx_cdata.gx_tx_map[i]);
}
void