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:
Landon J. Fuller 2017-12-02 00:52:59 +00:00
parent 1fe84e6f44
commit 19b3e4aa48
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326450

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