From: Sepherosa Ziehau Date: Mon, 13 Jul 2015 02:59:09 +0000 (+0800) Subject: bus: Clear device description when we set driver. X-Git-Url: https://gitweb.dragonflybsd.org/~nant/dragonfly.git/commitdiff_plain/72a106143adcdaba68f58c91ae7a91f967916721 bus: Clear device description when we set driver. This fixes several places that driver is detached, but device desc set by driver is not cleared, e.g. module unload. Minor cleanup, while I'm here. Reported-by: swildner@ --- diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index ea588ca02e..27174574d4 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -1263,7 +1263,6 @@ device_delete_child(device_t dev, device_t child) devclass_delete_device(child->devclass, child); TAILQ_REMOVE(&dev->children, child, link); TAILQ_REMOVE(&bus_data_devices, child, devlink); - device_set_desc(child, NULL); kobj_delete((kobj_t)child, M_BUS); bus_data_generation_update(); @@ -1405,7 +1404,7 @@ device_probe_child(device_t dev, device_t child) * certainly doesn't match. */ if (result > 0) { - device_set_driver(child, 0); + device_set_driver(child, NULL); continue; } @@ -1769,6 +1768,7 @@ device_set_driver(device_t dev, driver_t *driver) kfree(dev->softc, M_BUS); dev->softc = NULL; } + device_set_desc(dev, NULL); kobj_delete((kobj_t) dev, 0); dev->driver = driver; if (driver) {