Module Name: src Committed By: gson Date: Mon Jan 26 20:32:18 UTC 2015
Modified Files: src/sys/dev/usb: uaudio.c Log Message: When dumping iot[] contents to the console for debugging, don't crash if iot[i].output is NULL for some i. Share code with the dumping of iot[i].inputs[], which already handled NULLs. To generate a diff of this commit: cvs rdiff -u -r1.141 -r1.142 src/sys/dev/usb/uaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/usb/uaudio.c diff -u src/sys/dev/usb/uaudio.c:1.141 src/sys/dev/usb/uaudio.c:1.142 --- src/sys/dev/usb/uaudio.c:1.141 Mon Jan 26 09:25:08 2015 +++ src/sys/dev/usb/uaudio.c Mon Jan 26 20:32:17 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: uaudio.c,v 1.141 2015/01/26 09:25:08 gson Exp $ */ +/* $NetBSD: uaudio.c,v 1.142 2015/01/26 20:32:17 gson Exp $ */ /* * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.141 2015/01/26 09:25:08 gson Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.142 2015/01/26 20:32:17 gson Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -252,6 +252,10 @@ Static const char *uac_names[] = { }; #endif +#ifdef UAUDIO_DEBUG +Static void uaudio_dump_tml + (struct terminal_list *tml); +#endif Static usbd_status uaudio_identify_ac (struct uaudio_softc *, const usb_config_descriptor_t *); Static usbd_status uaudio_identify_as @@ -1872,6 +1876,21 @@ uaudio_identify_as(struct uaudio_softc * return USBD_NORMAL_COMPLETION; } +#ifdef UAUDIO_DEBUG +Static void +uaudio_dump_tml(struct terminal_list *tml) { + if (tml == NULL) { + printf("NULL"); + } else { + int i; + for (i = 0; i < tml->size; i++) + printf("%s ", uaudio_get_terminal_name + (tml->terminals[i])); + } + printf("\n"); +} +#endif + Static usbd_status uaudio_identify_ac(struct uaudio_softc *sc, const usb_config_descriptor_t *cdesc) { @@ -2015,23 +2034,11 @@ uaudio_identify_ac(struct uaudio_softc * iot[i].d.desc->bDescriptorSubtype); } for (j = 0; j < iot[i].inputs_size; j++) { - int k; printf("\tinput%d: ", j); - tml = iot[i].inputs[j]; - if (tml == NULL) { - printf("NULL\n"); - continue; - } - for (k = 0; k < tml->size; k++) - printf("%s ", uaudio_get_terminal_name - (tml->terminals[k])); - printf("\n"); + uaudio_dump_tml(iot[i].inputs[j]); } printf("\toutput: "); - tml = iot[i].output; - for (j = 0; j < tml->size; j++) - printf("%s ", uaudio_get_terminal_name(tml->terminals[j])); - printf("\n"); + uaudio_dump_tml(iot[i].output); } #endif