Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Fix sense of conditional in previous.



details:   https://anonhg.NetBSD.org/src/rev/3773b81bf0e2
branches:  trunk
changeset: 931836:3773b81bf0e2
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri May 01 01:31:17 2020 +0000

description:
Fix sense of conditional in previous.

I must have tested (cold ? (void *)1 : curlwp) but then decided,
after testing, to replace cold by !curcpu_available() -- thinking
that would be a safe change to make, except I forgot to either write
the ! or change the sense of the conditional.  OOPS.

diffstat:

 sys/kern/kern_entropy.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (48 lines):

diff -r 96c247bca243 -r 3773b81bf0e2 sys/kern/kern_entropy.c
--- a/sys/kern/kern_entropy.c   Thu Apr 30 22:09:32 2020 +0000
+++ b/sys/kern/kern_entropy.c   Fri May 01 01:31:17 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_entropy.c,v 1.7 2020/04/30 20:06:40 riastradh Exp $       */
+/*     $NetBSD: kern_entropy.c,v 1.8 2020/05/01 01:31:17 riastradh Exp $       */
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.7 2020/04/30 20:06:40 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.8 2020/05/01 01:31:17 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -1566,7 +1566,7 @@
 
        if (E->sourcelock)
                return false;
-       E->sourcelock = (curcpu_available() ? (void *)1 : curlwp);
+       E->sourcelock = (curcpu_available() ? curlwp : (void *)1);
        return true;
 }
 
@@ -1582,9 +1582,9 @@
 
        KASSERT(E->stage == ENTROPY_COLD || mutex_owned(&E->lock));
 
-       KASSERTMSG(E->sourcelock == (curcpu_available() ? (void *)1 : curlwp),
+       KASSERTMSG(E->sourcelock == (curcpu_available() ? curlwp : (void *)1),
            "lwp %p releasing lock held by %p",
-           (curcpu_available() ? (void *)1 : curlwp), E->sourcelock);
+           (curcpu_available() ? curlwp : (void *)1), E->sourcelock);
        E->sourcelock = NULL;
        if (E->stage >= ENTROPY_WARM)
                cv_broadcast(&E->cv);
@@ -1600,7 +1600,7 @@
 rnd_sources_locked(void)
 {
 
-       return E->sourcelock == (curcpu_available() ? (void *)1 : curlwp);
+       return E->sourcelock == (curcpu_available() ? curlwp : (void *)1);
 }
 
 /*



Home | Main Index | Thread Index | Old Index