aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2013-09-16 21:20:21 -0400
committerBrian Norris <computersforpeace@gmail.com>2013-10-27 19:27:04 -0400
commit4ae7d228d6048d25a16bee209ebea24c5ecde825 (patch)
tree21826962595819f56227fe8ed1ae28e3a644fd47
parent2a3d933a46e9948e01fc34348bed0baec8d8bf2b (diff)
mtd: nand: correct extemded param page error handling
If the ONFI extended parameter page gives codeword_size == 0, the extended ECC information is corrupt and should not be used. Currently, we (correctly) avoid using the information, but we don't report the error to the caller, so the caller doesn't know that we didn't initialize ecc_strength_ds and ecc_step_ds. Now the caller can warn the user that it does not have sufficient information. This also removes the false and useless "ONFI extended param page detected" debug message (it was printed even on the aforementioned corruption, and for the success case, we don't really want a print). Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Huang Shijie <b32955@freescale.com>
-rw-r--r--drivers/mtd/nand/nand_base.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 00022b456dff..0b39d0c03f1e 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2912,12 +2912,13 @@ static int nand_flash_detect_ext_param_page(struct mtd_info *mtd,
2912 /* get the info we want. */ 2912 /* get the info we want. */
2913 ecc = (struct onfi_ext_ecc_info *)cursor; 2913 ecc = (struct onfi_ext_ecc_info *)cursor;
2914 2914
2915 if (ecc->codeword_size) { 2915 if (!ecc->codeword_size) {
2916 chip->ecc_strength_ds = ecc->ecc_bits; 2916 pr_debug("Invalid codeword size\n");
2917 chip->ecc_step_ds = 1 << ecc->codeword_size; 2917 goto ext_out;
2918 } 2918 }
2919 2919
2920 pr_info("ONFI extended param page detected.\n"); 2920 chip->ecc_strength_ds = ecc->ecc_bits;
2921 chip->ecc_step_ds = 1 << ecc->codeword_size;
2921 ret = 0; 2922 ret = 0;
2922 2923
2923ext_out: 2924ext_out: