From 773d84d28e55fcc64bb1a4d96a85661a7571a83f Mon Sep 17 00:00:00 2001 From: Huang Shijie Date: Thu, 24 Oct 2013 16:48:16 +0800 Subject: [PATCH] mtd: gpmi: fix ECC regression The legacy ECC layout uses all the OOB area by computing the ECC strength and ECC step size ourselves. The patch "2febcdf mtd: gpmi: set the BCHs geometry with the ecc info" makes the gpmi to use the ECC info (ECC strength and ECC step size) provided by the MTD code, and creates a different NAND ECC layout for the BCH, and use the new ECC layout. This causes a regression: We can not mount the ubifs which was created by the old NAND ECC layout. This patch fixes this issue by reverting to the legacy ECC layout firstly; if it fails, we try to use the new ECC layout. Signed-off-by: Huang Shijie Signed-off-by: Brian Norris --- drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index 59ab0692f0b9..0241763ec7e9 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c @@ -349,7 +349,8 @@ static int legacy_set_geometry(struct gpmi_nand_data *this) int common_nfc_set_geometry(struct gpmi_nand_data *this) { - return set_geometry_by_ecc_info(this) ? 0 : legacy_set_geometry(this); + return legacy_set_geometry(this) ? + (!set_geometry_by_ecc_info(this)) : 0; } struct dma_chan *get_dma_chan(struct gpmi_nand_data *this) -- 2.39.5