1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-30 08:19:09 +00:00

Sometimes we can call ed_detach() before the mtx has been initialized.

Avoid it if it hasn't been initialized.
This commit is contained in:
Warner Losh 2009-04-20 15:19:54 +00:00
parent 2034e6a11f
commit 98f751cd4b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=191321

View File

@ -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);
}