git: 03f641f9b1d8 - main - smbus: Use a bus_child_deleted method to free ivars for children
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 01 Nov 2024 14:13:11 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=03f641f9b1d82b7369c8988afbd75a32d9913aaf commit 03f641f9b1d82b7369c8988afbd75a32d9913aaf Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2024-11-01 14:10:10 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2024-11-01 14:10:10 +0000 smbus: Use a bus_child_deleted method to free ivars for children Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47372 --- sys/dev/smbus/smbus.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/dev/smbus/smbus.c b/sys/dev/smbus/smbus.c index eed1aa6efce0..b0983fa32c30 100644 --- a/sys/dev/smbus/smbus.c +++ b/sys/dev/smbus/smbus.c @@ -112,6 +112,12 @@ smbus_add_child(device_t dev, u_int order, const char *name, int unit) return (child); } +static void +smbus_child_deleted(device_t dev, device_t child) +{ + free(device_get_ivars(child), M_DEVBUF); +} + static void smbus_hinted_child(device_t bus, const char *dname, int dunit) { @@ -222,6 +228,7 @@ static device_method_t smbus_methods[] = { /* bus interface */ DEVMETHOD(bus_add_child, smbus_add_child), + DEVMETHOD(bus_child_deleted, smbus_child_deleted), DEVMETHOD(bus_hinted_child, smbus_hinted_child), DEVMETHOD(bus_probe_nomatch, smbus_probe_nomatch), DEVMETHOD(bus_child_location, smbus_child_location),