Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Feb 2012 19:16:02 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r232265 - head/sys/kern
Message-ID:  <201202281916.q1SJG2JE084107@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202281916.q1SJG2JE084107>