From: Axel Lin Date: Sun, 14 Aug 2011 03:31:04 +0000 (+0800) Subject: ASoC: sta32x: shortcut the for loop to get ir and mcs X-Git-Tag: v3.3-rc1~14^2~811 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a595238bad3d11b26d00bbda4ccbd38fe107cd1e;p=platform%2Fkernel%2Flinux-exynos.git 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 Acked-by: Johannes Stezenbach Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index fbd7eb9..3d155f5 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;