Don't forget to disconnect object from class.

This commit is contained in:
davidxu 2003-01-15 14:58:07 +00:00
parent 4743c6079e
commit 0893470fa0

View File

@ -240,7 +240,7 @@ struct dev_event_info
TAILQ_HEAD(devq, dev_event_info); TAILQ_HEAD(devq, dev_event_info);
struct dev_softc struct dev_softc
{ {
int inuse; int inuse;
int nonblock; int nonblock;
@ -996,7 +996,7 @@ device_delete_child(device_t dev, device_t child)
TAILQ_REMOVE(&dev->children, child, link); TAILQ_REMOVE(&dev->children, child, link);
TAILQ_REMOVE(&bus_data_devices, child, devlink); TAILQ_REMOVE(&bus_data_devices, child, devlink);
device_set_desc(child, NULL); device_set_desc(child, NULL);
free(child, M_BUS); kobj_delete((kobj_t) child, M_BUS);
bus_data_generation_update(); bus_data_generation_update();
return (0); return (0);
@ -1417,6 +1417,7 @@ device_set_driver(device_t dev, driver_t *driver)
dev->softc = malloc(driver->size, M_BUS, dev->softc = malloc(driver->size, M_BUS,
M_NOWAIT | M_ZERO); M_NOWAIT | M_ZERO);
if (!dev->softc) { if (!dev->softc) {
kobj_delete((kobj_t) dev, 0);
kobj_init((kobj_t) dev, &null_class); kobj_init((kobj_t) dev, &null_class);
dev->driver = NULL; dev->driver = NULL;
return (ENOMEM); return (ENOMEM);