summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_bus.c
diff options
context:
space:
mode:
authorn_hibma <n_hibma@FreeBSD.org>2001-01-08 22:16:26 +0000
committern_hibma <n_hibma@FreeBSD.org>2001-01-08 22:16:26 +0000
commitcfd616810dc740e22f6bce0439a23db59cf1f8c1 (patch)
treedc7f10fde3f76b81bbf4c1a0df45662d63b753e3 /sys/kern/subr_bus.c
parente42ccf8d79ffa7c3eab7b0edc9826a39595da584 (diff)
downloadFreeBSD-src-cfd616810dc740e22f6bce0439a23db59cf1f8c1.zip
FreeBSD-src-cfd616810dc740e22f6bce0439a23db59cf1f8c1.tar.gz
Unset the devclass if the attach fails and the devclass was not set to
begin with. Reviewed by: dfr
Diffstat (limited to 'sys/kern/subr_bus.c')
-rw-r--r--sys/kern/subr_bus.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 278599c..77ac35d 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -1013,6 +1013,7 @@ device_probe_and_attach(device_t dev)
{
device_t bus = dev->parent;
int error = 0;
+ int hasclass = (dev->devclass != 0);
if (dev->state >= DS_ALIVE)
return (0);
@@ -1028,6 +1029,9 @@ device_probe_and_attach(device_t dev)
else {
printf("device_probe_and_attach: %s%d attach returned %d\n",
dev->driver->name, dev->unit, error);
+ /* Unset the class; set in device_probe_child */
+ if (!hasclass)
+ device_set_devclass(dev, 0);
device_set_driver(dev, NULL);
dev->state = DS_NOTPRESENT;
}
OpenPOWER on IntegriCloud