Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 May 2012 07:32:27 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r235978 - head/sys/kern
Message-ID:  <201205250732.q4P7WRE2088000@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Fri May 25 07:32:26 2012
New Revision: 235978
URL: http://svn.freebsd.org/changeset/base/235978

Log:
  device_add_child: protect against child device with no driver but fixed unit number
  
  This combination doesn't make sense, unit numbers should be hardwired
  only in context of a known driver.  The wildcard devices should have
  wildcard unit numbers.
  
  Reviewed by:	jhb
  MFC after:	2 weeks

Modified:
  head/sys/kern/subr_bus.c

Modified: head/sys/kern/subr_bus.c
==============================================================================
--- head/sys/kern/subr_bus.c	Fri May 25 07:25:30 2012	(r235977)
+++ head/sys/kern/subr_bus.c	Fri May 25 07:32:26 2012	(r235978)
@@ -1810,6 +1810,8 @@ device_add_child_ordered(device_t dev, u
 
 	PDEBUG(("%s at %s with order %u as unit %d",
 	    name, DEVICENAME(dev), order, unit));
+	KASSERT(name != NULL || unit == -1,
+	    ("child device with wildcard name and specific unit number"));
 
 	child = make_device(dev, name, unit);
 	if (child == NULL)



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