ALSA: pcm: remove function local variable with alternative evaluation
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Thu, 8 Jun 2017 21:37:03 +0000 (06:37 +0900)
committerTakashi Iwai <tiwai@suse.de>
Thu, 8 Jun 2017 21:40:34 +0000 (23:40 +0200)
A local variable is used to judge whether a parameter should be handled
due to reverse dependency of the other rules. However, this can be
obsoleted by check of a sentinel in dependency array.

This commit removes the local variable and check the sentinel to reduce
stack usage.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/pcm_native.c

index 41aeb6facdec3e78fef0833aa7b70732f479975b..db4cdd114ed498ade4211ab864509aa9042c860b 100644 (file)
@@ -342,16 +342,13 @@ retry:
        for (k = 0; k < constrs->rules_num; k++) {
                struct snd_pcm_hw_rule *r = &constrs->rules[k];
                unsigned int d;
-               int doit = 0;
                if (r->cond && !(r->cond & params->flags))
                        continue;
                for (d = 0; r->deps[d] >= 0; d++) {
-                       if (vstamps[r->deps[d]] > rstamps[k]) {
-                               doit = 1;
+                       if (vstamps[r->deps[d]] > rstamps[k])
                                break;
-                       }
                }
-               if (!doit)
+               if (r->deps[d] < 0)
                        continue;
 
                if (trace_hw_mask_param_enabled()) {