git: 75da18816155 - stable/14 - ow: Use a bus_child_deleted method to free ivars for children
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 01 Dec 2024 04:57:09 UTC
The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=75da18816155847279cd0daaad0f29fb626de820 commit 75da18816155847279cd0daaad0f29fb626de820 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2024-11-01 14:08:52 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2024-12-01 02:46:06 +0000 ow: Use a bus_child_deleted method to free ivars for children Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47364 (cherry picked from commit 79dfe2b761891eb3ab1b6a769d4f6adc97335350) --- sys/dev/ow/ow.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/dev/ow/ow.c b/sys/dev/ow/ow.c index c5d1f18df17c..55ed4ec31284 100644 --- a/sys/dev/ow/ow.c +++ b/sys/dev/ow/ow.c @@ -331,6 +331,12 @@ ow_add_child(device_t dev, romid_t romid) return (0); } +static void +ow_child_deleted(device_t dev, device_t child) +{ + free(device_get_ivars(child), M_OW); +} + static device_t ow_child_by_romid(device_t dev, romid_t romid) { @@ -561,7 +567,6 @@ ow_detach(device_t ndev) { device_t *children, child; int nkid, i; - struct ow_devinfo *di; struct ow_softc *sc; sc = device_get_softc(ndev); @@ -578,8 +583,6 @@ ow_detach(device_t ndev) return ENOMEM; for (i = 0; i < nkid; i++) { child = children[i]; - di = device_get_ivars(child); - free(di, M_OW); device_delete_child(ndev, child); } free(children, M_TEMP); @@ -704,6 +707,7 @@ static device_method_t ow_methods[] = { DEVMETHOD(device_detach, ow_detach), /* Bus interface */ + DEVMETHOD(bus_child_deleted, ow_child_deleted), DEVMETHOD(bus_child_pnpinfo, ow_child_pnpinfo), DEVMETHOD(bus_read_ivar, ow_read_ivar), DEVMETHOD(bus_write_ivar, ow_write_ivar),