[U-Boot-Users] [PATCH]env_nand.c Added bad block management for environment variables

Scott Wood scottwood at freescale.com
Thu May 29 19:32:59 CEST 2008


Scott Wood wrote:
>> +	size_t end;
>> +	int ret_val = 0;
>> +	end = offset + CFG_ENV_SIZE;
>> +
>> +	for (; offset < end; offset += nand_info[0].erasesize) {
>> +		if (nand_block_isbad(&nand_info[0],offset))
>> +			ret_val = 1;
>> +	}
>> +
>> +	return ret_val;
> 
> size_t end = offset + CFG_ENV_SIZE;
> 
> while (offset < end)
> 	if (nand_block_isbad(&nand_info[0], offset))
> 		return 1;
> 
> return 0;

Err, with an offset increment in the loop, of course.

-Scott




More information about the U-Boot mailing list