diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index b400a4e3c65e..7b5c6ea439a6 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -57,8 +57,7 @@ static struct cdev *make_dev_credv(struct cdevsw *devsw, int minornr, void dev_lock(void) { - if (!mtx_initialized(&devmtx)) - mtx_init(&devmtx, "cdev", NULL, MTX_DEF); + mtx_lock(&devmtx); } diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index a0127e77d165..874540de96a2 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -67,6 +67,8 @@ __FBSDID("$FreeBSD$"); #include +#include + #include #include @@ -900,5 +902,6 @@ mutex_init(void) mtx_init(&Giant, "Giant", NULL, MTX_DEF | MTX_RECURSE); mtx_init(&sched_lock, "sched lock", NULL, MTX_SPIN | MTX_RECURSE); mtx_init(&proc0.p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK); + mtx_init(&devmtx, "cdev", NULL, MTX_DEF); mtx_lock(&Giant); }