From 6090db7d3839fb63f2a1e13be2d9892829aa2f6c Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Thu, 24 Sep 2009 17:03:32 +0000 Subject: [PATCH] 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 --- sys/kern/subr_bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index f202631ce88..3f51c5cada8 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -1017,7 +1017,7 @@ devclass_driver_added(devclass_t dc, driver_t *driver) * 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); /*