summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-03-01 10:36:39 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-03-04 08:28:34 +0100
commit97407dad8015f5900d83d185a05aa2f478d867ab (patch)
tree2dd64f476491348045d1ed67409841f98a35b304
parentb14ed856c37d81b48edbec3720c510b86f5d556c (diff)
downloadbarebox-97407dad8015f5900d83d185a05aa2f478d867ab.tar.gz
barebox-97407dad8015f5900d83d185a05aa2f478d867ab.tar.xz
imx-bbu-nand-fcb: optimize check for bad block loop
The argument passed to dbbt_data_create() contains the number of blocks, not the last block. This means we can exit the loop with '<' instead of '<=' Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/imx-bbu-nand-fcb.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c
index 22031f5b7f..6e33ee14e2 100644
--- a/common/imx-bbu-nand-fcb.c
+++ b/common/imx-bbu-nand-fcb.c
@@ -337,14 +337,14 @@ static int imx_bbu_write_firmware(struct mtd_info *mtd, unsigned block,
return block;
}
-static int dbbt_data_create(struct mtd_info *mtd, void *buf, int block_last)
+static int dbbt_data_create(struct mtd_info *mtd, void *buf, int num_blocks)
{
int n;
int n_bad_blocks = 0;
uint32_t *bb = buf + 0x8;
uint32_t *n_bad_blocksp = buf + 0x4;
- for (n = 0; n <= block_last; n++) {
+ for (n = 0; n < num_blocks; n++) {
loff_t offset = n * mtd->erasesize;
if (mtd_block_isbad(mtd, offset)) {
n_bad_blocks++;