diff --git a/sys/dev/iicbus/iicbus.c b/sys/dev/iicbus/iicbus.c --- a/sys/dev/iicbus/iicbus.c +++ b/sys/dev/iicbus/iicbus.c @@ -248,6 +248,18 @@ dev, order, name, unit, sizeof(struct iicbus_ivar))); } +static void +iicbus_child_deleted(device_t dev, device_t child) +{ + struct iicbus_ivar *devi; + + devi = device_get_ivars(child); + if (devi == NULL) + return; + resource_list_free(&devi->rl); + free(devi, M_DEVBUF); +} + static void iicbus_hinted_child(device_t bus, const char *dname, int dunit) { @@ -360,6 +372,7 @@ DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), DEVMETHOD(bus_get_resource_list, iicbus_get_resource_list), DEVMETHOD(bus_add_child, iicbus_add_child), + DEVMETHOD(bus_child_deleted, iicbus_child_deleted), DEVMETHOD(bus_print_child, iicbus_print_child), DEVMETHOD(bus_probe_nomatch, iicbus_probe_nomatch), DEVMETHOD(bus_read_ivar, iicbus_read_ivar),