svn commit: r191321 - head/sys/dev/ed
Warner Losh
imp at FreeBSD.org
Mon Apr 20 15:19:55 UTC 2009
Author: imp
Date: Mon Apr 20 15:19:54 2009
New Revision: 191321
URL: http://svn.freebsd.org/changeset/base/191321
Log:
Sometimes we can call ed_detach() before the mtx has been initialized.
Avoid it if it hasn't been initialized.
Modified:
head/sys/dev/ed/if_ed.c
Modified: head/sys/dev/ed/if_ed.c
==============================================================================
--- head/sys/dev/ed/if_ed.c Mon Apr 20 15:15:24 2009 (r191320)
+++ head/sys/dev/ed/if_ed.c Mon Apr 20 15:19:54 2009 (r191321)
@@ -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);
}
More information about the svn-src-all
mailing list