From d5ca7f4f2b3f950eceb91ff6d4e4a7ec2505dae1 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Mon, 28 Jun 2004 02:24:04 +0000 Subject: [PATCH] Allow dev to be NULL and assume that a device is not alive or not attached. Reviewed by: njl(?) and jhb --- sys/kern/subr_bus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index fd2e9d4b2068..10ad9094882a 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -1587,13 +1587,13 @@ device_is_enabled(device_t dev) int device_is_alive(device_t dev) { - return (dev->state >= DS_ALIVE); + return (dev != NULL && dev->state >= DS_ALIVE); } int device_is_attached(device_t dev) { - return (dev->state >= DS_ATTACHED); + return (dev != NULL && dev->state >= DS_ATTACHED); } int