mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-22 10:48:02 +00:00
bhndb(4): Fix leak of child devices and MSI vectors.
- Add missing call to device_delete_children() in bhndb_detach(), without which we're left with stale child devices on module unload. - Pass the parent PCI device to pci_release_msi(), not the bhndb_pci(4) child. Approved by: adrian (mentor, implicit) Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
19b3e4aa48
commit
d16875a806
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326451
|
@ -639,6 +639,10 @@ bhndb_generic_detach(device_t dev)
|
|||
if ((error = bus_generic_detach(dev)))
|
||||
return (error);
|
||||
|
||||
/* Delete children */
|
||||
if ((error = device_delete_children(dev)))
|
||||
return (error);
|
||||
|
||||
/* Clean up our service registry */
|
||||
if ((error = bhnd_service_registry_fini(&sc->services)))
|
||||
return (error);
|
||||
|
|
|
@ -303,8 +303,10 @@ bhndb_pci_alloc_msi(struct bhndb_pci_softc *sc, int *msi_count)
|
|||
return (error);
|
||||
}
|
||||
|
||||
if (count < BHNDB_PCI_MSI_COUNT)
|
||||
if (count < BHNDB_PCI_MSI_COUNT) {
|
||||
pci_release_msi(sc->parent);
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
*msi_count = count;
|
||||
return (0);
|
||||
|
@ -412,7 +414,7 @@ bhndb_pci_attach(device_t dev)
|
|||
bhndb_free_intr_isrc(sc->isrc);
|
||||
|
||||
if (sc->msi_count > 0)
|
||||
pci_release_msi(dev);
|
||||
pci_release_msi(sc->parent);
|
||||
|
||||
if (cores != NULL)
|
||||
free(cores, M_BHND);
|
||||
|
@ -449,7 +451,7 @@ bhndb_pci_detach(device_t dev)
|
|||
|
||||
/* Release MSI interrupts */
|
||||
if (sc->msi_count > 0)
|
||||
pci_release_msi(dev);
|
||||
pci_release_msi(sc->parent);
|
||||
|
||||
/* Disable PCI bus mastering */
|
||||
pci_disable_busmaster(sc->parent);
|
||||
|
|
Loading…
Reference in a new issue