git: 190b7cd16067 - stable/13 - 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:58 UTC
The branch stable/13 has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=190b7cd16067ae8d79066d604f99834d16841a13
commit 190b7cd16067ae8d79066d604f99834d16841a13
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-11-01 14:08:52 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-11-30 21:41:46 +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 465df5d34438..9121e1b75653 100644
--- a/sys/dev/ow/ow.c
+++ b/sys/dev/ow/ow.c
@@ -330,6 +330,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)
{
@@ -560,7 +566,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);
@@ -577,8 +582,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);
@@ -719,6 +722,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_str, ow_child_pnpinfo_str),
DEVMETHOD(bus_child_location_str, ow_child_location_str),
DEVMETHOD(bus_read_ivar, ow_read_ivar),