Author: jhb
Date: Tue Feb 28 19:16:02 2012
New Revision: 232265
URL: http://svn.freebsd.org/changeset/base/232265

Log:
  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

Modified:
  head/sys/kern/subr_bus.c

Modified: head/sys/kern/subr_bus.c
==============================================================================
--- head/sys/kern/subr_bus.c    Tue Feb 28 18:38:33 2012        (r232264)
+++ head/sys/kern/subr_bus.c    Tue Feb 28 19:16:02 2012        (r232265)
@@ -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;
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to