summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mutex.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_mutex.c')
-rw-r--r--sys/kern/kern_mutex.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index 8dc6a03..ba6efe5 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -670,8 +670,10 @@ mtx_init(struct mtx *m, const char *description, int opts)
mtx_validate(m);
#endif
- bzero(m, sizeof(*m));
lock = &m->mtx_object;
+ KASSERT((lock->lo_flags & LO_INITIALIZED) == 0,
+ ("mutex %s %p already initialized", description, m));
+ bzero(m, sizeof(*m));
if (opts & MTX_SPIN)
lock->lo_class = &lock_class_mtx_spin;
else
OpenPOWER on IntegriCloud