All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Abhishek Sahu <absahu@codeaurora.org>
Cc: Boris Brezillon <boris.brezillon@bootlin.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Richard Weinberger <richard@nod.at>,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mtd@lists.infradead.org, stable@vger.kernel.org
Subject: Re: [PATCH] mtd: rawnand: fix return value check for bad block status
Date: Mon, 18 Jun 2018 15:57:57 +0200	[thread overview]
Message-ID: <20180618155757.6cbe0fae@xps13> (raw)
In-Reply-To: <1528880556-20348-1-git-send-email-absahu@codeaurora.org>

Hi Boris,

On Wed, 13 Jun 2018 14:32:36 +0530, Abhishek Sahu
<absahu@codeaurora.org> wrote:

> Positive return value from read_oob() is making false BAD
> blocks. For some of the NAND controllers, OOB bytes will be
> protected with ECC and read_oob() will return number of bitflips.
> If there is any bitflip in ECC protected OOB bytes for BAD block
> status page, then that block is getting treated as BAD.
> 
> Fixes: c120e75e0e7d ("mtd: nand: use read_oob() instead of cmdfunc() for bad block check")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
> ---
>  drivers/mtd/nand/raw/nand_base.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> index f28c3a5..4a73f73 100644
> --- a/drivers/mtd/nand/raw/nand_base.c
> +++ b/drivers/mtd/nand/raw/nand_base.c
> @@ -440,7 +440,7 @@ static int nand_block_bad(struct mtd_info *mtd, loff_t ofs)
>  
>  	for (; page < page_end; page++) {
>  		res = chip->ecc.read_oob(mtd, chip, page);
> -		if (res)
> +		if (res < 0)
>  			return res;
>  
>  		bad = chip->oob_poi[chip->badblockpos];

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

I suppose this patch is a good candidate to be part of a future
mtd/fixes PR?

Regards,
Miquèl

WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Abhishek Sahu <absahu@codeaurora.org>
Cc: Boris Brezillon <boris.brezillon@bootlin.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Richard Weinberger <richard@nod.at>,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mtd@lists.infradead.org, <stable@vger.kernel.org>
Subject: Re: [PATCH] mtd: rawnand: fix return value check for bad block status
Date: Mon, 18 Jun 2018 15:57:57 +0200	[thread overview]
Message-ID: <20180618155757.6cbe0fae@xps13> (raw)
In-Reply-To: <1528880556-20348-1-git-send-email-absahu@codeaurora.org>

Hi Boris,

On Wed, 13 Jun 2018 14:32:36 +0530, Abhishek Sahu
<absahu@codeaurora.org> wrote:

> Positive return value from read_oob() is making false BAD
> blocks. For some of the NAND controllers, OOB bytes will be
> protected with ECC and read_oob() will return number of bitflips.
> If there is any bitflip in ECC protected OOB bytes for BAD block
> status page, then that block is getting treated as BAD.
> 
> Fixes: c120e75e0e7d ("mtd: nand: use read_oob() instead of cmdfunc() for bad block check")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
> ---
>  drivers/mtd/nand/raw/nand_base.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> index f28c3a5..4a73f73 100644
> --- a/drivers/mtd/nand/raw/nand_base.c
> +++ b/drivers/mtd/nand/raw/nand_base.c
> @@ -440,7 +440,7 @@ static int nand_block_bad(struct mtd_info *mtd, loff_t ofs)
>  
>  	for (; page < page_end; page++) {
>  		res = chip->ecc.read_oob(mtd, chip, page);
> -		if (res)
> +		if (res < 0)
>  			return res;
>  
>  		bad = chip->oob_poi[chip->badblockpos];

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

I suppose this patch is a good candidate to be part of a future
mtd/fixes PR?

Regards,
Miquèl

  reply	other threads:[~2018-06-18 13:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-13  9:02 [PATCH] mtd: rawnand: fix return value check for bad block status Abhishek Sahu
2018-06-13  9:02 ` Abhishek Sahu
2018-06-18 13:57 ` Miquel Raynal [this message]
2018-06-18 13:57   ` Miquel Raynal
2018-06-22 11:34   ` Boris Brezillon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180618155757.6cbe0fae@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=absahu@codeaurora.org \
    --cc=boris.brezillon@bootlin.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=richard@nod.at \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.