Hello,

In uaudio_add_mixer() the number of input channels (ichs) is
only used in a DPRINTF statement so the code to set its value
can be excluded unless we're building a debug kernel. In my
understanding uaudio_get_cluster_nchan() has no side effects.

- Michael


Index: uaudio.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/uaudio.c,v
retrieving revision 1.132
diff -u -p -u -r1.132 uaudio.c
--- uaudio.c    8 Aug 2018 14:25:50 -0000       1.132
+++ uaudio.c    20 Aug 2018 09:16:45 -0000
@@ -750,17 +750,21 @@ uaudio_add_mixer(struct uaudio_softc *sc
 {
        const struct usb_audio_mixer_unit *d = iot[id].d.mu;
        struct usb_audio_mixer_unit_1 *d1;
-       int c, chs, ichs, ochs, i, o, bno, p, mo, mc, k;
+       int c, chs, ochs, i, o, bno, p, mo, mc, k;
+#ifdef UAUDIO_DEBUG
+       int ichs = 0;
+#endif
        uByte *bm;
        struct mixerctl mix;
 
        DPRINTFN(2,("%s: bUnitId=%d bNrInPins=%d\n", __func__,
                    d->bUnitId, d->bNrInPins));
 
+#ifdef UAUDIO_DEBUG
        /* Compute the number of input channels */
-       ichs = 0;
        for (i = 0; i < d->bNrInPins; i++)
                ichs += uaudio_get_cluster_nchan(d->baSourceId[i], iot);
+#endif
 
        /* and the number of output channels */
        d1 = (struct usb_audio_mixer_unit_1 *)&d->baSourceId[d->bNrInPins];

Reply via email to