* [PATCH] mtd: rawnand: fix return value check for bad block status
@ 2018-06-13 9:02 ` Abhishek Sahu
0 siblings, 0 replies; 5+ messages in thread
From: Abhishek Sahu @ 2018-06-13 9:02 UTC (permalink / raw)
To: Boris Brezillon
Cc: David Woodhouse, Brian Norris, Marek Vasut, Richard Weinberger,
Miquel Raynal, linux-arm-msm, linux-kernel, linux-mtd,
Abhishek Sahu, stable
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];
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc.
is a member of Code Aurora Forum, hosted by The Linux Foundation
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] mtd: rawnand: fix return value check for bad block status
@ 2018-06-13 9:02 ` Abhishek Sahu
0 siblings, 0 replies; 5+ messages in thread
From: Abhishek Sahu @ 2018-06-13 9:02 UTC (permalink / raw)
To: Boris Brezillon
Cc: David Woodhouse, Brian Norris, Marek Vasut, Richard Weinberger,
Miquel Raynal, linux-arm-msm, linux-kernel, linux-mtd,
Abhishek Sahu, stable
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];
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc.
is a member of Code Aurora Forum, hosted by The Linux Foundation
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: rawnand: fix return value check for bad block status
2018-06-13 9:02 ` Abhishek Sahu
@ 2018-06-18 13:57 ` Miquel Raynal
-1 siblings, 0 replies; 5+ messages in thread
From: Miquel Raynal @ 2018-06-18 13:57 UTC (permalink / raw)
To: Abhishek Sahu
Cc: Boris Brezillon, David Woodhouse, Brian Norris, Marek Vasut,
Richard Weinberger, linux-arm-msm, linux-kernel, linux-mtd,
stable
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: rawnand: fix return value check for bad block status
@ 2018-06-18 13:57 ` Miquel Raynal
0 siblings, 0 replies; 5+ messages in thread
From: Miquel Raynal @ 2018-06-18 13:57 UTC (permalink / raw)
To: Abhishek Sahu
Cc: Boris Brezillon, David Woodhouse, Brian Norris, Marek Vasut,
Richard Weinberger, linux-arm-msm, linux-kernel, linux-mtd,
stable
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: rawnand: fix return value check for bad block status
2018-06-18 13:57 ` Miquel Raynal
(?)
@ 2018-06-22 11:34 ` Boris Brezillon
-1 siblings, 0 replies; 5+ messages in thread
From: Boris Brezillon @ 2018-06-22 11:34 UTC (permalink / raw)
To: Miquel Raynal
Cc: Abhishek Sahu, Marek Vasut, linux-arm-msm, linux-kernel, stable,
linux-mtd, Richard Weinberger, Brian Norris, David Woodhouse
On Mon, 18 Jun 2018 15:57:57 +0200
Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> 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>
Applied.
Thanks,
Boris
>
> I suppose this patch is a good candidate to be part of a future
> mtd/fixes PR?
>
> Regards,
> Miquèl
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-06-22 11:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2018-06-18 13:57 ` Miquel Raynal
2018-06-22 11:34 ` Boris Brezillon
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.