svn commit: r197462 - head/sys/kern

Alexander Motin mav at FreeBSD.org
Thu Sep 24 17:03:32 UTC 2009


Author: mav
Date: Thu Sep 24 17:03:32 2009
New Revision: 197462
URL: http://svn.freebsd.org/changeset/base/197462

Log:
  Do not call BUS_DRIVER_ADDED() for detached buses (attach failed) on
  driver load. This fixes crash on atapicam module load on systems,
  where some ata channels (usually ata1) was probed, but failed to attach.
  
  Reviewed by:	jhb, imp
  Tested by:	many

Modified:
  head/sys/kern/subr_bus.c

Modified: head/sys/kern/subr_bus.c
==============================================================================
--- head/sys/kern/subr_bus.c	Thu Sep 24 16:57:35 2009	(r197461)
+++ head/sys/kern/subr_bus.c	Thu Sep 24 17:03:32 2009	(r197462)
@@ -1017,7 +1017,7 @@ devclass_driver_added(devclass_t dc, dri
 	 * Call BUS_DRIVER_ADDED for any existing busses in this class.
 	 */
 	for (i = 0; i < dc->maxunit; i++)
-		if (dc->devices[i])
+		if (dc->devices[i] && device_is_attached(dc->devices[i]))
 			BUS_DRIVER_ADDED(dc->devices[i], driver);
 
 	/*


More information about the svn-src-head mailing list