[alsa-devel] [PATCH RFC 20/21] ALSA: pcm: return error immediately for parameters refinement
Takashi Sakamoto
o-takashi at sakamocchi.jp
Sun May 14 10:57:55 CEST 2017
When refining mask/interval parameters, helper functions can return error
code. This error is not handled immediately, thus there're useless
processing.
This commit handles the error immediately.
Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
---
sound/core/pcm_native.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 92ab8b2..05230f4 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -288,11 +288,13 @@ static int constrain_mask_params(struct snd_pcm_substream *substream,
trace_hw_params_mask(substream, k, -1, &old_mask, m);
+ if (changed < 0)
+ return changed;
+
+
/* Set corresponding flag so that applications get it. */
if (changed)
params->cmask |= 1 << k;
- if (changed < 0)
- return changed;
}
return 0;
@@ -326,11 +328,12 @@ static int constrain_interval_params(struct snd_pcm_substream *substream,
trace_hw_params_interval(substream, k, -1, &old_interval, i);
+ if (changed < 0)
+ return changed;
+
/* Set corresponding flag so that applications get it. */
if (changed)
params->cmask |= 1 << k;
- if (changed < 0)
- return changed;
}
return 0;
@@ -431,6 +434,9 @@ static int constrain_params_by_rules(struct snd_pcm_substream *substream,
hw_param_interval(params, r->var));
}
+ if (changed < 0)
+ return changed;
+
rstamps[k] = stamp;
/*
@@ -443,8 +449,6 @@ static int constrain_params_by_rules(struct snd_pcm_substream *substream,
vstamps[r->var] = stamp;
again = true;
}
- if (changed < 0)
- return changed;
stamp++;
}
--
2.9.3
More information about the Alsa-devel
mailing list