Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Turn a few KASSERTs into KASSERTMSG mentioning t...
details: https://anonhg.NetBSD.org/src/rev/70b7bb640eaf
branches: trunk
changeset: 346328:70b7bb640eaf
user: maya <maya%NetBSD.org@localhost>
date: Thu Jul 07 10:53:03 2016 +0000
description:
Turn a few KASSERTs into KASSERTMSG mentioning the tested values
Some of these values are optimized out, so knowing why the test failed
can be challenging.
diffstat:
sys/dev/usb/xhci.c | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diffs (90 lines):
diff -r 101faa1fc321 -r 70b7bb640eaf sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c Thu Jul 07 09:32:01 2016 +0000
+++ b/sys/dev/usb/xhci.c Thu Jul 07 10:53:03 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xhci.c,v 1.58 2016/06/12 15:20:02 skrll Exp $ */
+/* $NetBSD: xhci.c,v 1.59 2016/07/07 10:53:03 maya Exp $ */
/*
* Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.58 2016/06/12 15:20:02 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.59 2016/07/07 10:53:03 maya Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -2103,7 +2103,7 @@
DPRINTFN(4, "device address %u", addr, 0, 0, 0);
/* XXX ensure we know when the hardware does something
we can't yet cope with */
- KASSERT(addr >= 1 && addr <= 127);
+ KASSERTMSG(addr >= 1 && addr <= 127, "addr %d", addr);
dev->ud_addr = addr;
/* XXX dev->ud_addr not necessarily unique on bus */
KASSERT(bus->ub_devices[dev->ud_addr] == NULL);
@@ -2208,13 +2208,13 @@
XHCIHIST_FUNC(); XHCIHIST_CALLED();
- KASSERT(ntrbs <= XHCI_XFER_NTRB);
+ KASSERTMSG(ntrbs <= XHCI_XFER_NTRB, "ntrbs %zu", ntrbs);
for (i = 0; i < ntrbs; i++) {
DPRINTFN(12, "xr %p trbs %p num %zu", xr, trbs, i, 0);
DPRINTFN(12, " %016"PRIx64" %08"PRIx32" %08"PRIx32,
trbs[i].trb_0, trbs[i].trb_2, trbs[i].trb_3, 0);
- KASSERT(XHCI_TRB_3_TYPE_GET(trbs[i].trb_3) !=
- XHCI_TRB_TYPE_LINK);
+ KASSERTMSG(XHCI_TRB_3_TYPE_GET(trbs[i].trb_3) !=
+ XHCI_TRB_TYPE_LINK, "trb3 type %d", trbs[i].trb_3);
}
DPRINTFN(12, "%p xr_ep 0x%x xr_cs %u", xr, xr->xr_ep, xr->xr_cs, 0);
@@ -2529,7 +2529,7 @@
XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_EVALUATE_CTX);
err = xhci_do_command(sc, &trb, USBD_DEFAULT_TIMEOUT);
- KASSERT(err == USBD_NORMAL_COMPLETION); /* XXX */
+ KASSERTMSG(err == USBD_NORMAL_COMPLETION, "err %d", err); /* XXX */
return err;
}
@@ -3431,7 +3431,8 @@
UGETW(req->wIndex), UGETW(req->wLength));
/* we rely on the bottom bits for extra info */
- KASSERT(((uintptr_t)xfer & 0x3) == 0x0);
+ KASSERTMSG(((uintptr_t)xfer & 0x3) == 0x0, "xfer %zx",
+ (uintptr_t) xfer);
KASSERT((xfer->ux_rqflags & URQ_REQUEST) != 0);
@@ -3449,7 +3450,7 @@
if (len != 0) {
/* data phase */
parameter = DMAADDR(dma, 0);
- KASSERT(len <= 0x10000);
+ KASSERTMSG(len <= 0x10000, "len %d", len);
status = XHCI_TRB_2_IRQ_SET(0) |
XHCI_TRB_2_TDSZ_SET(1) |
XHCI_TRB_2_BYTES_SET(len);
@@ -3586,7 +3587,7 @@
* data block be sent.
* The earlier documentation differs, I don't know how it behaves.
*/
- KASSERT(len <= 0x10000);
+ KASSERTMSG(len <= 0x10000, "len %d", len);
status = XHCI_TRB_2_IRQ_SET(0) |
XHCI_TRB_2_TDSZ_SET(1) |
XHCI_TRB_2_BYTES_SET(len);
@@ -3691,7 +3692,7 @@
KASSERT((xfer->ux_rqflags & URQ_REQUEST) == 0);
parameter = DMAADDR(dma, 0);
- KASSERT(len <= 0x10000);
+ KASSERTMSG(len <= 0x10000, "len %d", len);
status = XHCI_TRB_2_IRQ_SET(0) |
XHCI_TRB_2_TDSZ_SET(1) |
XHCI_TRB_2_BYTES_SET(len);
Home |
Main Index |
Thread Index |
Old Index