Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/hdaudio remove redundant assignments



details:   https://anonhg.NetBSD.org/src/rev/6dac805275e2
branches:  trunk
changeset: 353045:6dac805275e2
user:      maya <maya%NetBSD.org@localhost>
date:      Tue Apr 18 16:30:21 2017 +0000

description:
remove redundant assignments
nchan is overwritten before it is used in all cases. so is i.

from clang static analyzer
ok riastradh

diffstat:

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

diffs (50 lines):

diff -r 888e24f29820 -r 6dac805275e2 sys/dev/hdaudio/hdafg.c
--- a/sys/dev/hdaudio/hdafg.c   Tue Apr 18 15:14:28 2017 +0000
+++ b/sys/dev/hdaudio/hdafg.c   Tue Apr 18 16:30:21 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.10 2016/10/25 09:15:55 pgoyette Exp $ */
+/* $NetBSD: hdafg.c,v 1.11 2017/04/18 16:30:21 maya Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <support%precedence.co.uk@localhost>
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.10 2016/10/25 09:15:55 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.11 2017/04/18 16:30:21 maya Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -1468,7 +1468,6 @@
        do {
                done = 1;
                /* Disable and mute controls for disabled widgets */
-               i = 0;
                for (i = 0; i < sc->sc_nctls; i++) {
                        ctl = &sc->sc_ctls[i];
                        if (ctl->ctl_enable == false)
@@ -2790,7 +2789,6 @@
                }
        }
        /* Treat unrequired as possible */
-       i = 0;
        for (i = 0; i < sc->sc_nctls; i++) {
                ctl = &sc->sc_ctls[i];
                if (ctl->ctl_audiomask == 0)
@@ -3424,13 +3422,13 @@
 
        sc->sc_pchan = sc->sc_rchan = 0;
 
-       for (nchan = 0, i = 0; i < sc->sc_nassocs; i++) {
+       for (i = 0; i < sc->sc_nassocs; i++) {
                nchan = hdafg_assoc_count_channels(sc, &as[i],
                    HDAUDIO_PINDIR_OUT);
                if (nchan > sc->sc_pchan)
                        sc->sc_pchan = nchan;
        }
-       for (nchan = 0, i = 0; i < sc->sc_nassocs; i++) {
+       for (i = 0; i < sc->sc_nassocs; i++) {
                nchan = hdafg_assoc_count_channels(sc, &as[i],
                    HDAUDIO_PINDIR_IN);
                if (nchan > sc->sc_rchan)



Home | Main Index | Thread Index | Old Index