git: 87bb96bb4788 - stable/14 - smbus: 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:17 UTC
The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=87bb96bb4788cc33c1a9b19671bdd0884acc5152 commit 87bb96bb4788cc33c1a9b19671bdd0884acc5152 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2024-11-01 14:10:10 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2024-12-01 02:46:07 +0000 smbus: Use a bus_child_deleted method to free ivars for children Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47372 (cherry picked from commit 03f641f9b1d82b7369c8988afbd75a32d9913aaf) --- 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 074530081049..3d0f5fe65464 100644 --- a/sys/dev/smbus/smbus.c +++ b/sys/dev/smbus/smbus.c @@ -113,6 +113,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) { @@ -223,6 +229,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),