summaryrefslogtreecommitdiffstats
path: root/sys/dev/ed
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2009-04-20 15:19:54 +0000
committerimp <imp@FreeBSD.org>2009-04-20 15:19:54 +0000
commitdfdb0873974045d6d058ecc28453a6c8091472d9 (patch)
tree96714de022d61424da1028d561642c2458e119a0 /sys/dev/ed
parente4b8a090a6af17492b3d8d785e5e834a0aa8ec98 (diff)
downloadFreeBSD-src-dfdb0873974045d6d058ecc28453a6c8091472d9.zip
FreeBSD-src-dfdb0873974045d6d058ecc28453a6c8091472d9.tar.gz
Sometimes we can call ed_detach() before the mtx has been initialized.
Avoid it if it hasn't been initialized.
Diffstat (limited to 'sys/dev/ed')
-rw-r--r--sys/dev/ed/if_ed.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c
index 0cc38cd..5a60569 100644
--- a/sys/dev/ed/if_ed.c
+++ b/sys/dev/ed/if_ed.c
@@ -373,7 +373,8 @@ ed_detach(device_t dev)
struct ed_softc *sc = device_get_softc(dev);
struct ifnet *ifp = sc->ifp;
- ED_ASSERT_UNLOCKED(sc);
+ if (mtx_initialized(ED_MUTEX(sc)))
+ ED_ASSERT_UNLOCKED(sc);
if (ifp) {
ED_LOCK(sc);
if (bus_child_present(dev))
@@ -388,7 +389,8 @@ ed_detach(device_t dev)
ed_release_resources(dev);
if (sc->miibus)
device_delete_child(dev, sc->miibus);
- ED_LOCK_DESTROY(sc);
+ if (mtx_initialized(ED_MUTEX(sc)))
+ ED_LOCK_DESTROY(sc);
bus_generic_detach(dev);
return (0);
}
OpenPOWER on IntegriCloud