Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/wscons wsdisplay(4): KASSERT(a && b) -> KASSERT(a); ...



details:   https://anonhg.NetBSD.org/src/rev/6d3101f939b0
branches:  trunk
changeset: 368524:6d3101f939b0
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Jul 17 11:43:11 2022 +0000

description:
wsdisplay(4): KASSERT(a && b) -> KASSERT(a); KASSERT(b)

Better diagnostics this way.  No other functional change.  Omit
needless #ifdef DIAGNOSTIC while here; the compiler can optimize the
dead code away.

diffstat:

 sys/dev/wscons/wsdisplay.c       |  11 ++++++-----
 sys/dev/wscons/wsdisplay_vcons.c |  10 ++++++----
 2 files changed, 12 insertions(+), 9 deletions(-)

diffs (73 lines):

diff -r db2e1307bd9c -r 6d3101f939b0 sys/dev/wscons/wsdisplay.c
--- a/sys/dev/wscons/wsdisplay.c        Sun Jul 17 11:42:55 2022 +0000
+++ b/sys/dev/wscons/wsdisplay.c        Sun Jul 17 11:43:11 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay.c,v 1.163 2021/12/31 14:19:57 riastradh Exp $ */
+/* $NetBSD: wsdisplay.c,v 1.164 2022/07/17 11:43:11 riastradh Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.163 2021/12/31 14:19:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.164 2022/07/17 11:43:11 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_wsdisplay_compat.h"
@@ -790,12 +790,13 @@
 wsdisplay_suspend(device_t dv, const pmf_qual_t *qual)
 {
        struct wsdisplay_softc *sc = device_private(dv);
-#ifdef DIAGNOSTIC
        struct wsscreen *scr = sc->sc_focus;
+
        if (sc->sc_flags & SC_XATTACHED) {
-               KASSERT(scr && scr->scr_syncops);
+               KASSERT(scr);
+               KASSERT(scr->scr_syncops);
        }
-#endif
+
 #if 1
        /*
         * XXX X servers should have been detached earlier.
diff -r db2e1307bd9c -r 6d3101f939b0 sys/dev/wscons/wsdisplay_vcons.c
--- a/sys/dev/wscons/wsdisplay_vcons.c  Sun Jul 17 11:42:55 2022 +0000
+++ b/sys/dev/wscons/wsdisplay_vcons.c  Sun Jul 17 11:43:11 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wsdisplay_vcons.c,v 1.60 2022/07/17 11:31:47 riastradh Exp $ */
+/*     $NetBSD: wsdisplay_vcons.c,v 1.61 2022/07/17 11:43:11 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.60 2022/07/17 11:31:47 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.61 2022/07/17 11:43:11 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1317,7 +1317,8 @@
        struct rasops_info *ri;
        int error;
 
-       KASSERT(scr != NULL && wsc != NULL);
+       KASSERT(scr != NULL);
+       KASSERT(wsc != NULL);
 
        ri = &scr->scr_ri;
 
@@ -1356,7 +1357,8 @@
        struct rasops_info *ri;
        int fg, bg, ul;
 
-       KASSERT(scr != NULL && wsc != NULL);
+       KASSERT(scr != NULL);
+       KASSERT(wsc != NULL);
 
        ri = &scr->scr_ri;
 



Home | Main Index | Thread Index | Old Index