From 11a8d6c2022a7c89b8b20d0c04b34c7c3badcb3e Mon Sep 17 00:00:00 2001 From: Nick Hibma Date: Mon, 8 Jan 2001 22:16:26 +0000 Subject: [PATCH] Unset the devclass if the attach fails and the devclass was not set to begin with. Reviewed by: dfr --- sys/kern/subr_bus.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 278599cd892b..77ac35d889f5 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; }