Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pckbport KASSERT that cmd is non-NULL in more places...



details:   https://anonhg.NetBSD.org/src/rev/939e3306bf0f
branches:  trunk
changeset: 325932:939e3306bf0f
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Sat Jan 11 20:29:03 2014 +0000

description:
KASSERT that cmd is non-NULL in more places, and in a place that previously
did not use KASSERT to do the same thing.

diffstat:

 sys/dev/pckbport/pckbport.c |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (38 lines):

diff -r bfcf0c880fae -r 939e3306bf0f sys/dev/pckbport/pckbport.c
--- a/sys/dev/pckbport/pckbport.c       Sat Jan 11 20:17:56 2014 +0000
+++ b/sys/dev/pckbport/pckbport.c       Sat Jan 11 20:29:03 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pckbport.c,v 1.16 2013/03/06 04:22:03 christos Exp $ */
+/* $NetBSD: pckbport.c,v 1.17 2014/01/11 20:29:03 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2004 Ben Harris
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pckbport.c,v 1.16 2013/03/06 04:22:03 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pckbport.c,v 1.17 2014/01/11 20:29:03 jakllsch Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -396,6 +396,7 @@
        struct pckbport_slotdata *q = t->t_slotdata[slot];
        struct pckbport_devcmd *cmd = TAILQ_FIRST(&q->cmdqueue);
 
+       KASSERT(cmd != NULL);
        if (q->polling) {
                do {
                        pckbport_poll_cmd1(t, slot, cmd);
@@ -432,10 +433,7 @@
        struct pckbport_slotdata *q = t->t_slotdata[slot];
        struct pckbport_devcmd *cmd = TAILQ_FIRST(&q->cmdqueue);
 
-#ifdef DIAGNOSTIC
-       if (!cmd)
-               panic("pckbport_cmdresponse: no active command");
-#endif
+       KASSERT(cmd != NULL);
        if (cmd->cmdidx < cmd->cmdlen) {
                if (data != KBR_ACK && data != KBR_RESEND)
                        return 0;



Home | Main Index | Thread Index | Old Index