mtd: nand_bbt: handle error case for nand_create_badblock_pattern()

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue Jun 10 23:59:10 PDT 2014


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=abb9cf78e80ab4407c3efb0950f08e6941bc7e73
Commit:     abb9cf78e80ab4407c3efb0950f08e6941bc7e73
Parent:     930de53701c139fd55c7f576b7da055dbb8aabdc
Author:     Brian Norris <computersforpeace at gmail.com>
AuthorDate: Tue May 20 22:34:40 2014 -0700
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Wed May 28 00:05:25 2014 -0700

    mtd: nand_bbt: handle error case for nand_create_badblock_pattern()
    
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/nand/nand_bbt.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 6cbf876..7f0c3b4 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -1282,6 +1282,7 @@ static int nand_create_badblock_pattern(struct nand_chip *this)
 int nand_default_bbt(struct mtd_info *mtd)
 {
 	struct nand_chip *this = mtd->priv;
+	int ret;
 
 	/* Is a flash based bad block table requested? */
 	if (this->bbt_options & NAND_BBT_USE_FLASH) {
@@ -1300,8 +1301,11 @@ int nand_default_bbt(struct mtd_info *mtd)
 		this->bbt_md = NULL;
 	}
 
-	if (!this->badblock_pattern)
-		nand_create_badblock_pattern(this);
+	if (!this->badblock_pattern) {
+		ret = nand_create_badblock_pattern(this);
+		if (ret)
+			return ret;
+	}
 
 	return nand_scan_bbt(mtd, this->badblock_pattern);
 }



More information about the linux-mtd-cvs mailing list