Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752558AbcK0PVk (ORCPT ); Sun, 27 Nov 2016 10:21:40 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:38006 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751634AbcK0PVc (ORCPT ); Sun, 27 Nov 2016 10:21:32 -0500 Date: Sun, 27 Nov 2016 16:21:29 +0100 From: Boris Brezillon To: Masahiro Yamada Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Marek Vasut , Brian Norris , Richard Weinberger , David Woodhouse , Cyrille Pitchen Subject: Re: [PATCH 09/39] mtd: nand: denali: fix erased page check code Message-ID: <20161127162129.67bb8e00@bbrezillon> In-Reply-To: <1480183585-592-10-git-send-email-yamada.masahiro@socionext.com> References: <1480183585-592-1-git-send-email-yamada.masahiro@socionext.com> <1480183585-592-10-git-send-email-yamada.masahiro@socionext.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1450 Lines: 39 On Sun, 27 Nov 2016 03:05:55 +0900 Masahiro Yamada wrote: > Currently, is_erased() is called against "buf" twice, so the second > call is meaningless. The second one should be checked against > chip->oob_poi. > IMO, patch 9 to 12 should be squashed in a single patch. All you're doing in these patch is fixing the check_erased_page logic. You can describe the different broken thing in the commit message, but splitting things as you do does not help much. Also, please have at nand_check_erased_ecc_chunk() [1] instead of using a private method (is_erased()) to check if the page is erased. With this method you get bitflips in erased pages correction for free. [1]http://lxr.free-electrons.com/source/drivers/mtd/nand/nand_base.c#L1212 > Signed-off-by: Masahiro Yamada > --- > > drivers/mtd/nand/denali.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c > index cbc7f75..753e9a02 100644 > --- a/drivers/mtd/nand/denali.c > +++ b/drivers/mtd/nand/denali.c > @@ -1160,7 +1160,7 @@ static int denali_read_page(struct mtd_info *mtd, struct nand_chip *chip, > if (check_erased_page) { > if (!is_erased(buf, mtd->writesize)) > mtd->ecc_stats.failed++; > - if (!is_erased(buf, mtd->oobsize)) > + if (!is_erased(chip->oob_poi, mtd->oobsize)) > mtd->ecc_stats.failed++; > } > }