Browse Source

mtd: nand_bbt: handle error case for nand_create_badblock_pattern()

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Brian Norris 11 years ago
parent
commit
abb9cf78e8
1 changed files with 6 additions and 2 deletions
  1. 6 2
      drivers/mtd/nand/nand_bbt.c

+ 6 - 2
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)
 int nand_default_bbt(struct mtd_info *mtd)
 {
 {
 	struct nand_chip *this = mtd->priv;
 	struct nand_chip *this = mtd->priv;
+	int ret;
 
 
 	/* Is a flash based bad block table requested? */
 	/* Is a flash based bad block table requested? */
 	if (this->bbt_options & NAND_BBT_USE_FLASH) {
 	if (this->bbt_options & NAND_BBT_USE_FLASH) {
@@ -1300,8 +1301,11 @@ int nand_default_bbt(struct mtd_info *mtd)
 		this->bbt_md = NULL;
 		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);
 	return nand_scan_bbt(mtd, this->badblock_pattern);
 }
 }