Index: sys/kern/kern_event.c =================================================================== --- sys/kern/kern_event.c +++ sys/kern/kern_event.c @@ -2414,23 +2414,16 @@ void (*kl_assert_lock)(void *, int)) { - if (lock == NULL) - knl->kl_lockarg = &knlist_lock; - else - knl->kl_lockarg = lock; + KASSERT(lock != NULL, ("knlist_init lock NULL")); + KASSERT(kl_lock != NULL, ("knlist_init lock fn NULL")); + KASSERT(kl_unlock != NULL, ("knlist_init unlock fn NULL")); + KASSERT(kl_assert_lock != NULL, + ("knlist_init assert locked fn NULL")); - if (kl_lock == NULL) - knl->kl_lock = knlist_mtx_lock; - else - knl->kl_lock = kl_lock; - if (kl_unlock == NULL) - knl->kl_unlock = knlist_mtx_unlock; - else - knl->kl_unlock = kl_unlock; - if (kl_assert_lock == NULL) - knl->kl_assert_lock = knlist_mtx_assert_lock; - else - knl->kl_assert_lock = kl_assert_lock; + knl->kl_lockarg = lock; + knl->kl_lock = kl_lock; + knl->kl_unlock = kl_unlock; + knl->kl_assert_lock = kl_assert_lock; knl->kl_autodestroy = 0; SLIST_INIT(&knl->kl_list); @@ -2439,8 +2432,11 @@ void knlist_init_mtx(struct knlist *knl, struct mtx *lock) { + if (lock == NULL) + lock = &knlist_lock; - knlist_init(knl, lock, NULL, NULL, NULL); + knlist_init(knl, lock, knlist_mtx_lock, knlist_mtx_unlock, + knlist_mtx_assert_lock); } struct knlist *