From owner-svn-src-head@FreeBSD.ORG Wed Feb 11 05:00:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 129601065674; Wed, 11 Feb 2009 05:00:23 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id A20868FC1B; Wed, 11 Feb 2009 05:00:22 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n1B4xZ93060400; Tue, 10 Feb 2009 21:59:35 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Tue, 10 Feb 2009 21:59:34 -0700 (MST) Message-Id: <20090210.215934.1159135034.imp@bsdimp.com> To: mav@freebsd.org From: "M. Warner Losh" In-Reply-To: <200902102322.n1ANMTgW007393@svn.freebsd.org> References: <200902102322.n1ANMTgW007393@svn.freebsd.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r188464 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Feb 2009 05:00:23 -0000 In message: <200902102322.n1ANMTgW007393@svn.freebsd.org> Alexander Motin writes: : Author: mav : Date: Tue Feb 10 23:22:29 2009 : New Revision: 188464 : URL: http://svn.freebsd.org/changeset/base/188464 : : Log: : Check for device_set_devclass() errors and skip driver probe/attach if any. : Attach call without devclass set crashes the system. : : On resume AHCI driver sometimes tries to create duplicate adX device. : It is surely his own problem, but IMHO it is not a reason to crash here. : Other reasons are also possible. : : Modified: : head/sys/kern/subr_bus.c : : Modified: head/sys/kern/subr_bus.c : ============================================================================== : --- head/sys/kern/subr_bus.c Tue Feb 10 23:17:20 2009 (r188463) : +++ head/sys/kern/subr_bus.c Tue Feb 10 23:22:29 2009 (r188464) : @@ -1756,8 +1756,13 @@ device_probe_child(device_t dev, device_ : dl = next_matching_driver(dc, child, dl)) { : PDEBUG(("Trying %s", DRIVERNAME(dl->driver))); : device_set_driver(child, dl->driver); : - if (!hasclass) : - device_set_devclass(child, dl->driver->name); : + if (!hasclass) { : + if (device_set_devclass(child, dl->driver->name)) { : + PDEBUG(("Unable to set device class")); : + device_set_driver(child, NULL); : + continue; : + } : + } : : /* Fetch any flags for the device before probing. */ : resource_int_value(dl->driver->name, child->unit, I'd prefer applying this patch to make it whine louder so we don't forget about it: Index: subr_bus.c =================================================================== --- subr_bus.c (revision 188476) +++ subr_bus.c (working copy) @@ -1758,7 +1758,8 @@ device_set_driver(child, dl->driver); if (!hasclass) { if (device_set_devclass(child, dl->driver->name)) { - PDEBUG(("Unable to set device class")); + printf("driver bug: Unable to set devclass (devname: %s)\n", + DEVICENAME(child)); device_set_driver(child, NULL); continue; } Comments? Warner