summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2012-02-28 19:16:02 +0000
committerjhb <jhb@FreeBSD.org>2012-02-28 19:16:02 +0000
commit22eaf01bc1018e5e8eede316b67192f397d25000 (patch)
treec9a40d4ae11635d787a75e3a2807856b5c10b013
parent738f5859fbaedfa052e9d809ac04a31d3dcd9ab5 (diff)
downloadFreeBSD-src-22eaf01bc1018e5e8eede316b67192f397d25000.zip
FreeBSD-src-22eaf01bc1018e5e8eede316b67192f397d25000.tar.gz
Properly clear a device's devclass if DEVICE_ATTACH() fails if the device
does not have a fixed devclass. Reviewed by: imp MFC after: 2 weeks
-rw-r--r--sys/kern/subr_bus.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index f44c353..d485b9f 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -2732,9 +2732,8 @@ device_attach(device_t dev)
if ((error = DEVICE_ATTACH(dev)) != 0) {
printf("device_attach: %s%d attach returned %d\n",
dev->driver->name, dev->unit, error);
- /* Unset the class; set in device_probe_child */
- if (dev->devclass == NULL)
- (void)device_set_devclass(dev, NULL);
+ if (!(dev->flags & DF_FIXEDCLASS))
+ devclass_delete_device(dev->devclass, dev);
(void)device_set_driver(dev, NULL);
device_sysctl_fini(dev);
dev->state = DS_NOTPRESENT;
OpenPOWER on IntegriCloud