[U-Boot] [PATCH 1/1] Make FAT code comply to coding rules.

Wolfgang Denk wd at denx.de
Mon Dec 8 23:40:36 CET 2008


Dear =?utf-8?q?Remy=20B=C3=B6hmer?=,

In message <1228772871-19776-1-git-send-email-linux at bohmer.net> you wrote:
> Currently the fat code is messy related to Coding rules.

...but your new code has new issues, too.

> -	if (cur_dev->block_read) {
> -		return cur_dev->block_read (cur_dev->dev
> -			, startblock, getsize, (unsigned long *)bufptr);
> -	}
> +	if (cur_dev->block_read)
> +		return cur_dev->block_read(cur_dev->dev, startblock, nofblocks,
> +					   (unsigned long *)bufptr);

Multi-line statements do require the curly braces, and two lines is
multi-line.

And this...

> -	actsize=bytesperclust;
> -	endclust=curclust;
> -	do {
> +	actsize = bytesperclust;
> +	endclust = curclust;
> +	for (;;) {
>  		/* search for consecutive clusters */
> -		while(actsize < filesize) {
> +		while (actsize < filesize) {
>  			newclust = get_fatent(mydata, endclust);
> -			if((newclust -1)!=endclust)
> -				goto getit;
> +			if ((newclust - 1) != endclust) {
> +				if (get_cluster(mydata, curclust, buffer,
> +							   (int)actsize) != 0) {
> +					FAT_ERROR("Error reading cluster\n");
> +					return -1;
> +				}
> +				gotsize += (int)actsize;
> +				filesize -= actsize;
> +				buffer += actsize;
> +				curclust = get_fatent(mydata, endclust);
> +				if (CHECK_CLUST(curclust, mydata->fatsize)) {
> +					FAT_DPRINT("curclust: 0x%x\n",
> +						   curclust);
> +					FAT_ERROR("Invalid FAT entry\n");
> +					return gotsize;
> +				}
> +				actsize = bytesperclust;
> +				endclust = curclust;
> +				continue;
> +			}

...looks like a massive code change, not only a coding style cleanup.
Please submit as two separate patches.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I'm a programmer: I don't buy software, I write it.
                                                  -- Tom Christiansen


More information about the U-Boot mailing list