Allow a NULL dev to be passed to _devsw(). This should close any remaining
authorMatthew Dillon <dillon@dragonflybsd.org>
Sat, 23 Aug 2003 16:58:36 +0000 (16:58 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Sat, 23 Aug 2003 16:58:36 +0000 (16:58 +0000)
kernel panics related to non-existant devices.

sys/kern/kern_device.c

index 256c1bf..a22cfa9 100644 (file)
@@ -25,7 +25,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $DragonFly: src/sys/kern/kern_device.c,v 1.4 2003/08/12 02:36:15 dillon Exp $
+ * $DragonFly: src/sys/kern/kern_device.c,v 1.5 2003/08/23 16:58:36 dillon Exp $
  */
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -175,6 +175,8 @@ static __inline
 struct cdevsw *
 _devsw(dev_t dev)
 {
+    if (dev == NULL)
+       return(NULL);
     if (dev->si_devsw)
        return (dev->si_devsw);
     return(cdevsw[major(dev)]);