[alsa-devel] [PATCH] dbri: more cleanups

Takashi Iwai tiwai at suse.de
Mon Sep 3 14:46:38 CEST 2007


At Sat, 1 Sep 2007 22:57:30 +0200,
Krzysztof Helt wrote:
> 
> From: Krzysztof Helt <krzysztof.h1 at wp.pl>
> 
> This patch:
> - removes redundant constant suffices
> - removes redundant parentheses
> - removes redundant curly brackets

I don't think that removing braces blindly is a good idea.
The removal of brace is good if the statement is a single line, but
not for the multiple lines.  For example,

	for (;;) {
		if (...) {
			...
		}
	}

It's especially true for the brace for multiple if.

	if (...) {
		if (...)
			...
	}


> @@ -2442,11 +2430,10 @@ static int __init snd_dbri_mixer(struct 
>  	card = dbri->card;
>  	strcpy(card->mixername, card->shortname);
>  
> -	for (idx = 0; idx < ARRAY_SIZE(dbri_controls); idx++) {
> +	for (idx = 0; idx < ARRAY_SIZE(dbri_controls); idx++)
>  		if ((err = snd_ctl_add(card,
>  				snd_ctl_new1(&dbri_controls[idx], dbri))) < 0)
>  			return err;
> -	}

Let's split if ((er = ...)).

>  
> @@ -2637,7 +2623,6 @@ static int __init dbri_attach(int prom_n
>  		goto _err;
>  
>  	if ((err = snd_dbri_mixer(dbri)) < 0)
> -	if ((err = snd_dbri_mixer(dbri)) < 0)
>  		goto _err;
>  
>  	/* /proc file handling */

Ditto.


Thanks,

Takashi


More information about the Alsa-devel mailing list