[alsa-devel] [PATCH] Avoid useless loop

Mark Brown broonie at opensource.wolfsonmicro.com
Sun Apr 10 15:33:40 CEST 2011


On Sun, Apr 10, 2011 at 07:19:20PM -0400, keroid1 at gmail.com wrote:

>  	/* bind DAIs */
> -	for (i = 0; i < card->num_links; i++)
> -		soc_bind_dai_link(card, i);
> +	if (card->num_rtds != card->num_links) {
> +		for (i = 0; i < card->num_links; i++)
> +			soc_bind_dai_link(card, i);
> +	}
>  
>  	/* bind completed ? */
>  	if (card->num_rtd != card->num_links) {

It seems odd to have two if statements testing the same condition in
immediate succession, though we do need the second check after the flor
loop to match the final bind.  I'm not sure this is doing much except
adding a little complexity - it's not like this is a hot path.


More information about the Alsa-devel mailing list