diff mbox

[09/39] mtd: nand: denali: fix erased page check code

Message ID 1480183585-592-10-git-send-email-yamada.masahiro@socionext.com
State Deferred
Headers show

Commit Message

Masahiro Yamada Nov. 26, 2016, 6:05 p.m. UTC
Currently, is_erased() is called against "buf" twice, so the second
call is meaningless.  The second one should be checked against
chip->oob_poi.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/mtd/nand/denali.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Boris Brezillon Nov. 27, 2016, 3:21 p.m. UTC | #1
On Sun, 27 Nov 2016 03:05:55 +0900
Masahiro Yamada <yamada.masahiro@socionext.com> 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 <yamada.masahiro@socionext.com>
> ---
> 
>  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++;
>  		}
>  	}
Masahiro Yamada Dec. 2, 2016, 4:33 a.m. UTC | #2
Hi Boris,


2016-11-28 0:21 GMT+09:00 Boris Brezillon <boris.brezillon@free-electrons.com>:
> On Sun, 27 Nov 2016 03:05:55 +0900
> Masahiro Yamada <yamada.masahiro@socionext.com> 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.


OK. I will do so.

I realized some mistakes in this part
(both in my patches and in the current mainline code),
so I will rework it in a more sensible chunk.


> 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.

I will use this helper, thanks!




With this, I think I answered all of your questions to v1.

(Please tell me if there is something I missed to answer.)

Thanks a lot for your review.
Boris Brezillon Dec. 2, 2016, 7:57 a.m. UTC | #3
On Fri, 2 Dec 2016 13:33:58 +0900
Masahiro Yamada <yamada.masahiro@socionext.com> wrote:

> Hi Boris,
> 
> 
> 2016-11-28 0:21 GMT+09:00 Boris Brezillon <boris.brezillon@free-electrons.com>:
> > On Sun, 27 Nov 2016 03:05:55 +0900
> > Masahiro Yamada <yamada.masahiro@socionext.com> 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.  
> 
> 
> OK. I will do so.
> 
> I realized some mistakes in this part
> (both in my patches and in the current mainline code),
> so I will rework it in a more sensible chunk.
> 
> 
> > 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.  
> 
> I will use this helper, thanks!
> 
> 
> 
> 
> With this, I think I answered all of your questions to v1.

You did. I'm waiting for the v2 now ;)

> 
> (Please tell me if there is something I missed to answer.)
> 
> Thanks a lot for your review.
> 
> 
>
diff mbox

Patch

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++;
 		}
 	}