summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/sta32x.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2011-08-14 11:31:04 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-08-15 22:54:11 +0900
commita595238bad3d11b26d00bbda4ccbd38fe107cd1e (patch)
tree43e8fa338345eee2705534c7d37aa0186e1d61da /sound/soc/codecs/sta32x.c
parent1f9099b41723c90bd2ff8238482e8598ef21a621 (diff)
downloadlinux-a595238bad3d11b26d00bbda4ccbd38fe107cd1e.tar.bz2
ASoC: sta32x: shortcut the for loop to get ir and mcs
There is exactly one match or no match at all during the for loop iteration, thus we can break from the for loop once a match is found. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Johannes Stezenbach <js@sig21.net> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/sta32x.c')
-rw-r--r--sound/soc/codecs/sta32x.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c
index fbd7eb9e61ce..3d155f526672 100644
--- a/sound/soc/codecs/sta32x.c
+++ b/sound/soc/codecs/sta32x.c
@@ -524,13 +524,17 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream,
rate = params_rate(params);
pr_debug("rate: %u\n", rate);
for (i = 0; i < ARRAY_SIZE(interpolation_ratios); i++)
- if (interpolation_ratios[i].fs == rate)
+ if (interpolation_ratios[i].fs == rate) {
ir = interpolation_ratios[i].ir;
+ break;
+ }
if (ir < 0)
return -EINVAL;
for (i = 0; mclk_ratios[ir][i].ratio; i++)
- if (mclk_ratios[ir][i].ratio * rate == sta32x->mclk)
+ if (mclk_ratios[ir][i].ratio * rate == sta32x->mclk) {
mcs = mclk_ratios[ir][i].mcs;
+ break;
+ }
if (mcs < 0)
return -EINVAL;