From e2157cf706690e84cb65f5150142db378f4776f1 Mon Sep 17 00:00:00 2001 From: Pyun YongHyeon Date: Thu, 8 Jan 2009 04:26:44 +0000 Subject: [PATCH] Always check whether dma map is valid before unloading the map. When fxp(4) intializes Rx buffers for the first time, there is no loaded dma map so attempting to unload it is an invalid operation. --- sys/dev/fxp/if_fxp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c index 9a6851c9c227..ca1a6141ae3f 100644 --- a/sys/dev/fxp/if_fxp.c +++ b/sys/dev/fxp/if_fxp.c @@ -2545,7 +2545,8 @@ fxp_new_rfabuf(struct fxp_softc *sc, struct fxp_rx *rxp) return (error); } - bus_dmamap_unload(sc->fxp_mtag, rxp->rx_map); + if (rxp->rx_mbuf != NULL) + bus_dmamap_unload(sc->fxp_mtag, rxp->rx_map); tmp_map = sc->spare_map; sc->spare_map = rxp->rx_map; rxp->rx_map = tmp_map;