Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Sep 2009 17:03:32 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r197462 - head/sys/kern
Message-ID:  <200909241703.n8OH3WMe002540@svn.freebsd.org>

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



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