diff options
author | dfr <dfr@FreeBSD.org> | 1998-11-15 18:11:21 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 1998-11-15 18:11:21 +0000 |
commit | 3d34322c0b502d5c01263b2101d3508474e291ce (patch) | |
tree | 0075699f337de7036b62aa0200fbc815ea767d60 /sys | |
parent | 7e9b66423254bcfc0c2b64f1fe77d2f3ffb982d7 (diff) | |
download | FreeBSD-src-3d34322c0b502d5c01263b2101d3508474e291ce.zip FreeBSD-src-3d34322c0b502d5c01263b2101d3508474e291ce.tar.gz |
A couple of minor sanity checks.
Submitted by: Nick Hibma <nick.hibma@jrc.it>
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/subr_bus.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index b40e8b9..50eb4d7 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: subr_bus.c,v 1.9 1998/11/13 09:39:37 dfr Exp $ + * $Id: subr_bus.c,v 1.10 1998/11/14 21:58:51 wollman Exp $ */ #include <sys/param.h> @@ -420,6 +420,9 @@ devclass_add_device(devclass_t dc, device_t dev) static int devclass_delete_device(devclass_t dc, device_t dev) { + if (!dc || !dev) + return 0; + PDEBUG(("%s in devclass %s", DEVICENAME(dev), DEVCLANAME(dc))); if (dev->devclass != dc @@ -508,7 +511,10 @@ device_add_child(device_t dev, const char *name, int unit, void *ivars) child = make_device(dev, name, unit, ivars); - TAILQ_INSERT_TAIL(&dev->children, child, link); + if (child) + TAILQ_INSERT_TAIL(&dev->children, child, link); + else + PDEBUG(("%s failed", name)); return child; } @@ -798,7 +804,7 @@ int device_probe_and_attach(device_t dev) { device_t bus = dev->parent; - int error; + int error = 0; if (dev->state >= DS_ALIVE) return 0; @@ -822,7 +828,7 @@ device_probe_and_attach(device_t dev) printf("not probed (disabled)\n"); } - return 0; + return error; } int |