lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110815122506.GA26490@sig21.net>
Date:	Mon, 15 Aug 2011 14:25:06 +0200
From:	Johannes Stezenbach <js@...21.net>
To:	Axel Lin <axel.lin@...il.com>
Cc:	linux-kernel@...r.kernel.org, Liam Girdwood <lrg@...com>,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	alsa-devel@...a-project.org
Subject: Re: [PATCH] ASoC: sta32x: shortcut the for loop to get ir and mcs

On Sun, Aug 14, 2011 at 11:31:04AM +0800, Axel Lin wrote:
> 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@...il.com>

Looks good.

Acked-by: Johannes Stezenbach <js@...21.net>


Thanks,
Johannes


> ---
>  sound/soc/codecs/sta32x.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> 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;
>  
> -- 
> 1.7.4.1
> 
> 
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ