From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Date: Thu, 29 May 2008 12:32:59 -0500 Subject: [U-Boot-Users] [PATCH]env_nand.c Added bad block management for environment variables In-Reply-To: <483EE840.6030002@freescale.com> References: <20080528175704.GA3090@loki.buserror.net> <483EE840.6030002@freescale.com> Message-ID: <483EE8CB.1060406@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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