* [PATCH] MTD: make s3c2410's correct_data indicate an error for multi-bit read errors
@ 2007-10-19 1:13 Matt Reimer
2007-10-19 8:24 ` Jörn Engel
0 siblings, 1 reply; 10+ messages in thread
From: Matt Reimer @ 2007-10-19 1:13 UTC (permalink / raw)
To: linux-mtd
If there were multiple bit errors in the data s3c2410_nand_correct_data()
was returning 0 (no error) instead of -1, so the upper layers (like JFFS2)
would not know the data is corrupt.
Signed-off-by: Matt Reimer <mreimer@vpop.net>
---
drivers/mtd/nand/s3c2410.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 077fdcc..2e6b435 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -397,7 +397,7 @@ static int s3c2410_nand_correct_data(struct
mtd_info *mtd, u_char *dat,
if ((diff0 & ~(1<<fls(diff0))) == 0)
return 1;
- return 0;
+ return -1;
}
/* ECC functions
--
1.5.3.2
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH] MTD: make s3c2410's correct_data indicate an error for multi-bit read errors
2007-10-19 1:13 [PATCH] MTD: make s3c2410's correct_data indicate an error for multi-bit read errors Matt Reimer
@ 2007-10-19 8:24 ` Jörn Engel
2007-10-19 9:00 ` Artem Bityutskiy
0 siblings, 1 reply; 10+ messages in thread
From: Jörn Engel @ 2007-10-19 8:24 UTC (permalink / raw)
To: Matt Reimer; +Cc: linux-mtd
On Thu, 18 October 2007 18:13:07 -0700, Matt Reimer wrote:
>
> If there were multiple bit errors in the data s3c2410_nand_correct_data()
> was returning 0 (no error) instead of -1, so the upper layers (like JFFS2)
> would not know the data is corrupt.
>
> Signed-off-by: Matt Reimer <mreimer@vpop.net>
> ---
> drivers/mtd/nand/s3c2410.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
> index 077fdcc..2e6b435 100644
> --- a/drivers/mtd/nand/s3c2410.c
> +++ b/drivers/mtd/nand/s3c2410.c
> @@ -397,7 +397,7 @@ static int s3c2410_nand_correct_data(struct
> mtd_info *mtd, u_char *dat,
> if ((diff0 & ~(1<<fls(diff0))) == 0)
> return 1;
>
> - return 0;
> + return -1;
> }
Why don't you return -EBADMSG?
Jörn
--
I can say that I spend most of my time fixing bugs even if I have lots
of new features to implement in mind, but I give bugs more priority.
-- Andrea Arcangeli, 2000
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] MTD: make s3c2410's correct_data indicate an error for multi-bit read errors
2007-10-19 8:24 ` Jörn Engel
@ 2007-10-19 9:00 ` Artem Bityutskiy
2007-10-19 19:29 ` Matt Reimer
0 siblings, 1 reply; 10+ messages in thread
From: Artem Bityutskiy @ 2007-10-19 9:00 UTC (permalink / raw)
To: Jörn Engel; +Cc: linux-mtd, Matt Reimer
On Fri, 2007-10-19 at 10:24 +0200, Jörn Engel wrote:
> > @@ -397,7 +397,7 @@ static int s3c2410_nand_correct_data(struct
> > mtd_info *mtd, u_char *dat,
> > if ((diff0 & ~(1<<fls(diff0))) == 0)
> > return 1;
> >
> > - return 0;
> > + return -1;
> > }
Yup, Jörn is right, you should return -EBADMSG on ECC errors and
-EUCLEAN if there was a correctable bit-flip.
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] MTD: make s3c2410's correct_data indicate an error for multi-bit read errors
2007-10-19 9:00 ` Artem Bityutskiy
@ 2007-10-19 19:29 ` Matt Reimer
2007-10-20 10:28 ` Jörn Engel
0 siblings, 1 reply; 10+ messages in thread
From: Matt Reimer @ 2007-10-19 19:29 UTC (permalink / raw)
To: dedekind; +Cc: Jörn Engel, linux-mtd
On 10/19/07, Artem Bityutskiy <dedekind@infradead.org> wrote:
> On Fri, 2007-10-19 at 10:24 +0200, Jörn Engel wrote:
> > > @@ -397,7 +397,7 @@ static int s3c2410_nand_correct_data(struct
> > > mtd_info *mtd, u_char *dat,
> > > if ((diff0 & ~(1<<fls(diff0))) == 0)
> > > return 1;
> > >
> > > - return 0;
> > > + return -1;
> > > }
>
> Yup, Jörn is right, you should return -EBADMSG on ECC errors and
> -EUCLEAN if there was a correctable bit-flip.
See the patch I posted a couple of days ago with the subject "MTD:
treat any negative return value from correct() as an error". Once that
patch is accepted, doing what you say will work as you expect; right
now, it results in lying to upper layers about errors.
Matt
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] MTD: make s3c2410's correct_data indicate an error for multi-bit read errors
2007-10-19 19:29 ` Matt Reimer
@ 2007-10-20 10:28 ` Jörn Engel
0 siblings, 0 replies; 10+ messages in thread
From: Jörn Engel @ 2007-10-20 10:28 UTC (permalink / raw)
To: Matt Reimer; +Cc: Jörn Engel, linux-mtd
On Fri, 19 October 2007 12:29:45 -0700, Matt Reimer wrote:
>
> See the patch I posted a couple of days ago with the subject "MTD:
> treat any negative return value from correct() as an error". Once that
> patch is accepted, doing what you say will work as you expect; right
> now, it results in lying to upper layers about errors.
I'll comment to that patch seperately. This one is
Acked-By: Joern Engel <joern@logfs.org>
Jörn
--
It does not matter how slowly you go, so long as you do not stop.
-- Confucius
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] MTD: make s3c2410's correct_data indicate an error for multi-bit read errors
@ 2007-10-20 16:48 Matt Reimer
2007-10-25 18:12 ` Matt Reimer
0 siblings, 1 reply; 10+ messages in thread
From: Matt Reimer @ 2007-10-20 16:48 UTC (permalink / raw)
To: linux-mtd; +Cc: Matt Reimer
From: Matt Reimer <mreimer@vpop.net>
If there were multiple bit errors in the data s3c2410_nand_correct_data()
was returning 0 (no error) instead of -EBADMSG, so the upper layers
(like JFFS2) would not know the data is corrupt.
Signed-off-by: Matt Reimer <mreimer@vpop.net>
---
drivers/mtd/nand/s3c2410.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 077fdcc..1aa3a18 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -397,7 +397,7 @@ static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,
if ((diff0 & ~(1<<fls(diff0))) == 0)
return 1;
- return 0;
+ return -EBADMSG;
}
/* ECC functions
--
1.5.3.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] MTD: make s3c2410's correct_data indicate an error for multi-bit read errors
2007-10-20 16:48 Matt Reimer
@ 2007-10-25 18:12 ` Matt Reimer
0 siblings, 0 replies; 10+ messages in thread
From: Matt Reimer @ 2007-10-25 18:12 UTC (permalink / raw)
To: linux-mtd
Anyone willing to ACK this patch?
Matt
On 10/20/07, Matt Reimer <mattjreimer@gmail.com> wrote:
> From: Matt Reimer <mreimer@vpop.net>
>
> If there were multiple bit errors in the data s3c2410_nand_correct_data()
> was returning 0 (no error) instead of -EBADMSG, so the upper layers
> (like JFFS2) would not know the data is corrupt.
>
> Signed-off-by: Matt Reimer <mreimer@vpop.net>
> ---
> drivers/mtd/nand/s3c2410.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
> index 077fdcc..1aa3a18 100644
> --- a/drivers/mtd/nand/s3c2410.c
> +++ b/drivers/mtd/nand/s3c2410.c
> @@ -397,7 +397,7 @@ static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,
> if ((diff0 & ~(1<<fls(diff0))) == 0)
> return 1;
>
> - return 0;
> + return -EBADMSG;
> }
>
> /* ECC functions
> --
> 1.5.3.2
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] MTD: make s3c2410's correct_data indicate an error for multi-bit read errors
@ 2007-10-20 16:44 Matt Reimer
2007-10-20 16:49 ` Matt Reimer
0 siblings, 1 reply; 10+ messages in thread
From: Matt Reimer @ 2007-10-20 16:44 UTC (permalink / raw)
To: linux-mtd; +Cc: Matt Reimer
From: Matt Reimer <mreimer@vpop.net>
If there were multiple bit errors in the data s3c2410_nand_correct_data()
was returning 0 (no error) instead of -1, so the upper layers (like JFFS2)
would not know the data is corrupt.
Signed-off-by: Matt Reimer <mreimer@vpop.net>
---
drivers/mtd/nand/s3c2410.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 077fdcc..1aa3a18 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -397,7 +397,7 @@ static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,
if ((diff0 & ~(1<<fls(diff0))) == 0)
return 1;
- return 0;
+ return -EBADMSG;
}
/* ECC functions
--
1.5.3.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] MTD: make s3c2410's correct_data indicate an error for multi-bit read errors
2007-10-20 16:44 Matt Reimer
@ 2007-10-20 16:49 ` Matt Reimer
0 siblings, 0 replies; 10+ messages in thread
From: Matt Reimer @ 2007-10-20 16:49 UTC (permalink / raw)
To: linux-mtd; +Cc: Matt Reimer
On 10/20/07, Matt Reimer <mattjreimer@gmail.com> wrote:
> From: Matt Reimer <mreimer@vpop.net>
>
> If there were multiple bit errors in the data s3c2410_nand_correct_data()
> was returning 0 (no error) instead of -1, so the upper layers (like JFFS2)
> would not know the data is corrupt.
Grr, ignore this patch, as I forget to amend the commit message. The
next one should get it right.
Matt
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] MTD: fix s3c2410 error correction
@ 2007-10-19 1:02 Matt Reimer
2007-10-19 1:02 ` [PATCH] MTD: make s3c2410's correct_data indicate an error for multi-bit read errors Matt Reimer
0 siblings, 1 reply; 10+ messages in thread
From: Matt Reimer @ 2007-10-19 1:02 UTC (permalink / raw)
To: linux-mtd; +Cc: Matt Reimer
From: Matt Reimer <mreimer@vpop.net>
The single-bit error correction was, well, incorrect. For determing which
bit to correct it was using P1' P2' P4' P8' instead of P1 P2 P4 P8, and
it was using P16' P32' P64' P128' P256' P512' P1024' P2048' instead of
P16 P32 P64 P128 P256 P512 P1024 P2048.
Signed-off-by: Matt Reimer <mreimer@vpop.net>
---
drivers/mtd/nand/s3c2410.c | 26 ++++++++++++--------------
1 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 903db18..077fdcc 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -364,23 +364,21 @@ static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,
((diff2 ^ (diff2 >> 1)) & 0x55) == 0x55) {
/* calculate the bit position of the error */
- bit = (diff2 >> 2) & 1;
- bit |= (diff2 >> 3) & 2;
- bit |= (diff2 >> 4) & 4;
+ bit = ((diff2 >> 3) & 1) |
+ ((diff2 >> 4) & 2) |
+ ((diff2 >> 5) & 4);
/* calculate the byte position of the error */
- byte = (diff1 << 1) & 0x80;
- byte |= (diff1 << 2) & 0x40;
- byte |= (diff1 << 3) & 0x20;
- byte |= (diff1 << 4) & 0x10;
-
- byte |= (diff0 >> 3) & 0x08;
- byte |= (diff0 >> 2) & 0x04;
- byte |= (diff0 >> 1) & 0x02;
- byte |= (diff0 >> 0) & 0x01;
-
- byte |= (diff2 << 8) & 0x100;
+ byte = ((diff2 << 7) & 0x100) |
+ ((diff1 << 0) & 0x80) |
+ ((diff1 << 1) & 0x40) |
+ ((diff1 << 2) & 0x20) |
+ ((diff1 << 3) & 0x10) |
+ ((diff0 >> 4) & 0x08) |
+ ((diff0 >> 3) & 0x04) |
+ ((diff0 >> 2) & 0x02) |
+ ((diff0 >> 1) & 0x01);
dev_dbg(info->device, "correcting error bit %d, byte %d\n",
bit, byte);
--
1.5.3.2
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH] MTD: make s3c2410's correct_data indicate an error for multi-bit read errors
2007-10-19 1:02 [PATCH] MTD: fix s3c2410 error correction Matt Reimer
@ 2007-10-19 1:02 ` Matt Reimer
0 siblings, 0 replies; 10+ messages in thread
From: Matt Reimer @ 2007-10-19 1:02 UTC (permalink / raw)
To: linux-mtd; +Cc: Matt Reimer
From: Matt Reimer <mreimer@vpop.net>
If there were multiple bit errors in the data s3c2410_nand_correct_data()
was returning 0 (no error) instead of -1, so the upper layers (like JFFS2)
would not know the data is corrupt.
Signed-off-by: Matt Reimer <mreimer@vpop.net>
---
drivers/mtd/nand/s3c2410.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 077fdcc..2e6b435 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -397,7 +397,7 @@ static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,
if ((diff0 & ~(1<<fls(diff0))) == 0)
return 1;
- return 0;
+ return -1;
}
/* ECC functions
--
1.5.3.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-10-25 18:13 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-19 1:13 [PATCH] MTD: make s3c2410's correct_data indicate an error for multi-bit read errors Matt Reimer
2007-10-19 8:24 ` Jörn Engel
2007-10-19 9:00 ` Artem Bityutskiy
2007-10-19 19:29 ` Matt Reimer
2007-10-20 10:28 ` Jörn Engel
-- strict thread matches above, loose matches on Subject: below --
2007-10-20 16:48 Matt Reimer
2007-10-25 18:12 ` Matt Reimer
2007-10-20 16:44 Matt Reimer
2007-10-20 16:49 ` Matt Reimer
2007-10-19 1:02 [PATCH] MTD: fix s3c2410 error correction Matt Reimer
2007-10-19 1:02 ` [PATCH] MTD: make s3c2410's correct_data indicate an error for multi-bit read errors Matt Reimer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox