Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752962AbcKZSIw (ORCPT ); Sat, 26 Nov 2016 13:08:52 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:48030 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753156AbcKZSIQ (ORCPT ); Sat, 26 Nov 2016 13:08:16 -0500 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com uAQI6Uep018512 X-Nifty-SrcIP: [111.169.71.157] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org, Boris Brezillon , Marek Vasut , Brian Norris , Richard Weinberger , David Woodhouse , Cyrille Pitchen Subject: [PATCH 19/39] mtd: nand: denali: perform erased check against raw transferred page Date: Sun, 27 Nov 2016 03:06:05 +0900 Message-Id: <1480183585-592-20-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1480183585-592-1-git-send-email-yamada.masahiro@socionext.com> References: <1480183585-592-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1286 Lines: 36 The erased page check must be done against the raw transferred data. The current first call of is_erase() is against the data after ECC correction. I saw cases where not all of the data in the page are 0xFF after they are manipulated by the ECC correction engine. Signed-off-by: Masahiro Yamada --- drivers/mtd/nand/denali.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index f035dac..ae44c01 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -1168,6 +1168,7 @@ static int denali_read_page(struct mtd_info *mtd, struct nand_chip *chip, INTR_STATUS__DMA_CMD_COMP | INTR_STATUS__ECC_UNCOR_ERR : INTR_STATUS__ECC_TRANSACTION_DONE | INTR_STATUS__ECC_ERR; bool check_erased_page = false; + int ret; if (page != denali->page) { dev_err(denali->dev, @@ -1206,7 +1207,9 @@ static int denali_read_page(struct mtd_info *mtd, struct nand_chip *chip, * error. */ - read_oob_data(mtd, chip->oob_poi, denali->page); + ret = denali_read_page_raw(mtd, chip, buf, 1, denali->page); + if (ret < 0) + return ret; /* check ECC failures that may have occurred on erased pages */ if (!is_erased(buf, mtd->writesize) || -- 2.7.4