Remove a test and early-out which just can't possibly be right. It causes
detach() to do nothing if attach() succeeded, which is the opposite of what's needed. Also, move device_delete_children() from the end to the beginning of detach(), so that children won't be trying to make use of the hardware we're in the process of shutting down. PR: 229510
This commit is contained in:
parent
5b04a71dae
commit
0b8530659c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=335985
@ -390,8 +390,9 @@ vybrid_ehci_detach(device_t dev)
|
||||
esc = device_get_softc(dev);
|
||||
sc = &esc->base;
|
||||
|
||||
if (sc->sc_flags & EHCI_SCFLG_DONEINIT)
|
||||
return (0);
|
||||
/* First detach all children; we can't detach if that fails. */
|
||||
if ((err = device_delete_children(dev)) != 0)
|
||||
return (err);
|
||||
|
||||
/*
|
||||
* only call ehci_detach() after ehci_init()
|
||||
@ -420,14 +421,6 @@ vybrid_ehci_detach(device_t dev)
|
||||
sc->sc_intr_hdl = NULL;
|
||||
}
|
||||
|
||||
if (sc->sc_bus.bdev) {
|
||||
device_delete_child(dev, sc->sc_bus.bdev);
|
||||
sc->sc_bus.bdev = NULL;
|
||||
}
|
||||
|
||||
/* During module unload there are lots of children leftover */
|
||||
device_delete_children(dev);
|
||||
|
||||
bus_release_resources(dev, vybrid_ehci_spec, esc->res);
|
||||
|
||||
return (0);
|
||||
|
Loading…
Reference in New Issue
Block a user