aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/nand_bbt.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 2d1d2fa9dfc5..e23115be079e 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -370,8 +370,8 @@ static u32 bbt_get_ver_offs(struct mtd_info *mtd, struct nand_bbt_descr *td)
370 * Read the bad block table(s) for all chips starting at a given page. We 370 * Read the bad block table(s) for all chips starting at a given page. We
371 * assume that the bbt bits are in consecutive order. 371 * assume that the bbt bits are in consecutive order.
372 */ 372 */
373static int read_abs_bbts(struct mtd_info *mtd, uint8_t *buf, 373static void read_abs_bbts(struct mtd_info *mtd, uint8_t *buf,
374 struct nand_bbt_descr *td, struct nand_bbt_descr *md) 374 struct nand_bbt_descr *td, struct nand_bbt_descr *md)
375{ 375{
376 struct nand_chip *this = mtd->priv; 376 struct nand_chip *this = mtd->priv;
377 377
@@ -392,7 +392,6 @@ static int read_abs_bbts(struct mtd_info *mtd, uint8_t *buf,
392 pr_info("Bad block table at page %d, version 0x%02X\n", 392 pr_info("Bad block table at page %d, version 0x%02X\n",
393 md->pages[0], md->version[0]); 393 md->pages[0], md->version[0]);
394 } 394 }
395 return 1;
396} 395}
397 396
398/* Scan a given block full */ 397/* Scan a given block full */
@@ -623,7 +622,9 @@ static int search_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
623 * 622 *
624 * Search and read the bad block table(s). 623 * Search and read the bad block table(s).
625 */ 624 */
626static int search_read_bbts(struct mtd_info *mtd, uint8_t * buf, struct nand_bbt_descr *td, struct nand_bbt_descr *md) 625static void search_read_bbts(struct mtd_info *mtd, uint8_t *buf,
626 struct nand_bbt_descr *td,
627 struct nand_bbt_descr *md)
627{ 628{
628 /* Search the primary table */ 629 /* Search the primary table */
629 search_bbt(mtd, buf, td); 630 search_bbt(mtd, buf, td);
@@ -631,9 +632,6 @@ static int search_read_bbts(struct mtd_info *mtd, uint8_t * buf, struct nand_bbt
631 /* Search the mirror table */ 632 /* Search the mirror table */
632 if (md) 633 if (md)
633 search_bbt(mtd, buf, md); 634 search_bbt(mtd, buf, md);
634
635 /* Force result check */
636 return 1;
637} 635}
638 636
639/** 637/**
@@ -1159,14 +1157,13 @@ int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd)
1159 1157
1160 /* Is the bbt at a given page? */ 1158 /* Is the bbt at a given page? */
1161 if (td->options & NAND_BBT_ABSPAGE) { 1159 if (td->options & NAND_BBT_ABSPAGE) {
1162 res = read_abs_bbts(mtd, buf, td, md); 1160 read_abs_bbts(mtd, buf, td, md);
1163 } else { 1161 } else {
1164 /* Search the bad block table using a pattern in oob */ 1162 /* Search the bad block table using a pattern in oob */
1165 res = search_read_bbts(mtd, buf, td, md); 1163 search_read_bbts(mtd, buf, td, md);
1166 } 1164 }
1167 1165
1168 if (res) 1166 res = check_create(mtd, buf, bd);
1169 res = check_create(mtd, buf, bd);
1170 1167
1171 /* Prevent the bbt regions from erasing / writing */ 1168 /* Prevent the bbt regions from erasing / writing */
1172 mark_bbt_region(mtd, td); 1169 mark_bbt_region(mtd, td);