bhnd_chipc(4): Break cyclic references to the ChipCommon device

bhnd_chipc's children may hold strong provider references to their parent;
we must detach any children before attempting to deregister the bhnd_chipc
device as a bus service provider.

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
landonf 2017-12-02 00:52:59 +00:00
parent 249504c849
commit 12100615d8

View File

@ -245,10 +245,10 @@ chipc_detach(device_t dev)
sc = device_get_softc(dev);
if ((error = bhnd_deregister_provider(dev, BHND_SERVICE_ANY)))
if ((error = bus_generic_detach(dev)))
return (error);
if ((error = bus_generic_detach(dev)))
if ((error = bhnd_deregister_provider(dev, BHND_SERVICE_ANY)))
return (error);
chipc_release_region(sc, sc->core_region, RF_ALLOCATED|RF_ACTIVE);