Unset the devclass if the attach fails and the devclass was not set to

begin with.

Reviewed by:	dfr
This commit is contained in:
Nick Hibma 2001-01-08 22:16:26 +00:00
parent 2ebaaccd47
commit 11a8d6c202

View File

@ -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;
}