From owner-freebsd-current@FreeBSD.ORG Fri Feb 24 17:54:39 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAE951065677; Fri, 24 Feb 2012 17:54:39 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id ACF978FC18; Fri, 24 Feb 2012 17:54:39 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 658E546B17; Fri, 24 Feb 2012 12:54:39 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id CAB55B94D; Fri, 24 Feb 2012 12:54:38 -0500 (EST) From: John Baldwin To: Alexey Dokuchaev Date: Fri, 24 Feb 2012 12:22:36 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <20110109140215.000011b8@unknown> <201202230828.48022.jhb@freebsd.org> <20120223144116.GA99564@FreeBSD.org> In-Reply-To: <20120223144116.GA99564@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="koi8-r" Content-Transfer-Encoding: 7bit Message-Id: <201202241222.37037.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 24 Feb 2012 12:54:38 -0500 (EST) Cc: Bruce Cran , freebsd-current@freebsd.org, Warner Losh Subject: Re: Loading uart module fails X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Feb 2012 17:54:39 -0000 On Thursday, February 23, 2012 9:41:16 am Alexey Dokuchaev wrote: > On Thu, Feb 23, 2012 at 08:28:47AM -0500, John Baldwin wrote: > > Hmm, can you see what 'dev->nameunit' is? Maybe just do 'p *dev' actually > > and reply with that. > > (kgdb) p *dev > $1 = {ops = 0xc50de000, link = {tqe_next = 0xc5271380, tqe_prev = > 0xc5271184}, > devlink = {tqe_next = 0xc5271380, tqe_prev = 0xc527118c}, > parent = 0xc51fca80, children = {tqh_first = 0x0, tqh_last = 0xc5271318}, > driver = 0x0, devclass = 0xc5270a40, unit = 0, > nameunit = 0xc5006a00 "uart0", > desc = 0xc5511205
, busy = 0, > state = DS_NOTPRESENT, devflags = 0, flags = 35, order = 30, > ivars = 0xc5270d00, softc = 0x0, sysctl_ctx = {tqh_first = 0x0, > tqh_last = 0x0}, sysctl_tree = 0x0} Try this for fixing the panic. New-bus was not clearing the description if a device's attach routine failed. Index: subr_bus.c =================================================================== --- subr_bus.c (revision 231983) +++ subr_bus.c (working copy) @@ -1129,7 +1129,6 @@ devclass_driver_deleted(devclass_t busclass, devcl dev->parent->devclass == busclass) { if ((error = device_detach(dev)) != 0) return (error); - (void)device_set_driver(dev, NULL); BUS_PROBE_NOMATCH(dev->parent, dev); devnomatch(dev); dev->flags |= DF_DONENOMATCH; @@ -2097,7 +2097,7 @@ device_probe_child(device_t dev, device_t child) /* XXX What happens if we rebid and got no best? */ if (best) { /* - * If this device was atached, and we were asked to + * If this device was attached, and we were asked to * rescan, and it is a different driver, then we have * to detach the old driver and reattach this new one. * Note, we don't have to check for DF_REBID here @@ -2604,6 +2606,7 @@ device_set_driver(device_t dev, driver_t *driver) free(dev->softc, M_BUS_SC); dev->softc = NULL; } + device_set_desc(dev, NULL); kobj_delete((kobj_t) dev, NULL); dev->driver = driver; if (driver) { @@ -2789,7 +2792,6 @@ device_detach(device_t dev) dev->state = DS_NOTPRESENT; (void)device_set_driver(dev, NULL); - device_set_desc(dev, NULL); device_sysctl_fini(dev); return (0); -- John Baldwin