summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/kern_synch.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index e268d107e44..50b3a851deb 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_synch.c,v 1.113 2014/01/23 00:33:36 guenther Exp $ */
+/* $OpenBSD: kern_synch.c,v 1.114 2014/01/23 01:48:44 guenther Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*
@@ -154,32 +154,30 @@ msleep(const volatile void *ident, struct mutex *mtx, int priority,
int error, error1, spl;
KASSERT((priority & ~(PRIMASK | PCATCH | PNORELOCK)) == 0);
+ KASSERT(mtx != NULL);
sleep_setup(&sls, ident, priority, wmesg);
sleep_setup_timeout(&sls, timo);
sleep_setup_signal(&sls, priority);
- if (mtx) {
- /* XXX - We need to make sure that the mutex doesn't
- * unblock splsched. This can be made a bit more
- * correct when the sched_lock is a mutex.
- */
- spl = MUTEX_OLDIPL(mtx);
- MUTEX_OLDIPL(mtx) = splsched();
- mtx_leave(mtx);
- }
+ /* XXX - We need to make sure that the mutex doesn't
+ * unblock splsched. This can be made a bit more
+ * correct when the sched_lock is a mutex.
+ */
+ spl = MUTEX_OLDIPL(mtx);
+ MUTEX_OLDIPL(mtx) = splsched();
+ mtx_leave(mtx);
sleep_finish(&sls, 1);
error1 = sleep_finish_timeout(&sls);
error = sleep_finish_signal(&sls);
- if (mtx) {
- if ((priority & PNORELOCK) == 0) {
- mtx_enter(mtx);
- MUTEX_OLDIPL(mtx) = spl; /* put the ipl back */
- } else
- splx(spl);
- }
+ if ((priority & PNORELOCK) == 0) {
+ mtx_enter(mtx);
+ MUTEX_OLDIPL(mtx) = spl; /* put the ipl back */
+ } else
+ splx(spl);
+
/* Signal errors are higher priority than timeouts. */
if (error == 0 && error1 != 0)
error = error1;