[PATCH 07/12] mtd: nand: return failure when failing to get ECC from ONFI

Brian Norris computersforpeace at gmail.com
Wed Sep 4 14:25:21 EDT 2013


If ONFI fails to provide ECC information, we should not use it. Print
appropriate error messages and return.

Signed-off-by: Brian Norris <computersforpeace at gmail.com>
Cc: Huang Shijie <b32955 at freescale.com>
---
 drivers/mtd/nand/nand_base.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 7ed4841..38b8dd4 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3010,8 +3010,13 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip,
 			chip->cmdfunc = nand_command_lp;
 
 		/* The Extended Parameter Page is supported since ONFI 2.1. */
-		if (nand_flash_detect_ext_param_page(mtd, chip, p))
-			pr_info("Failed to detect the extended param page.\n");
+		if (nand_flash_detect_ext_param_page(mtd, chip, p)) {
+			pr_info("Failed to detect ONFI extended param page\n");
+			return 0;
+		}
+	} else {
+		pr_err("Could not retrieve ONFI ECC requirements\n");
+		return 0;
 	}
 
 	pr_info("ONFI flash detected\n");
-- 
1.8.4




More information about the linux-mtd mailing list