diff options
author | Engling, Uwe <Uwe.Engling@ise.de> | 2017-10-10 14:20:55 +0000 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2017-10-16 09:42:51 -0400 |
commit | 41ba7f525fa21941dee062b87adbbd7dde72f32f (patch) | |
tree | 937c87872d5262b8a628e9ee00b613731be137f4 /fs | |
parent | d5587fa308c937a598fd10918593458e48040f14 (diff) | |
download | u-boot-41ba7f525fa21941dee062b87adbbd7dde72f32f.tar.gz |
jffs2: ECC corrected nand data is ignored
Hello,
I ran into a problem with the JFFS2 filesystem driver implemented in U-Boot.
I've got a NAND device that has correctable ECC errors (corrected somewhere in mtd/nand/nand_base.c).
The NAND driver tells the filesystem layer (jffs2_1pass.c) above that there occurred correctable ECC errors and returns with a "value > 0".
The JFFS2 driver recognizes the corrected ECC errors as real error and skips this block because the only accepts a "return value == 0" as correct.
This problem exists for over 8 years (I checked version 2010.09) so I'm a little bit worried that I interpreted something wrong or didn't get the whole context.
Can someone confirm this bug (and the bugfix) in the u-boot jffs2 driver?
There was a mail in 2012 that mentioned the same problem, but there was no patch:
http://u-boot.10912.n7.nabble.com/JFFS2-seems-to-drop-nand-data-with-ECC-corrections-td142008.html
Sometime after this discussion the return value of nand_read() changed from -EUCLEAN as correctable ECC error to a positive value with the count of ECC corrected errors.
With kind reguards,
Uwe Engling
Diffstat (limited to 'fs')
-rw-r--r-- | fs/jffs2/jffs2_1pass.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c index 4c6dfbf249..6bf1943958 100644 --- a/fs/jffs2/jffs2_1pass.c +++ b/fs/jffs2/jffs2_1pass.c @@ -201,7 +201,7 @@ static int read_nand_cached(u32 off, u32 size, u_char *buf) retlen = NAND_CACHE_SIZE; if (nand_read(mtd, nand_cache_off, - &retlen, nand_cache) != 0 || + &retlen, nand_cache) < 0 || retlen != NAND_CACHE_SIZE) { printf("read_nand_cached: error reading nand off %#x size %d bytes\n", nand_cache_off, NAND_CACHE_SIZE); @@ -300,7 +300,7 @@ static int read_onenand_cached(u32 off, u32 size, u_char *buf) retlen = ONENAND_CACHE_SIZE; if (onenand_read(&onenand_mtd, onenand_cache_off, retlen, - &retlen, onenand_cache) != 0 || + &retlen, onenand_cache) < 0 || retlen != ONENAND_CACHE_SIZE) { printf("read_onenand_cached: error reading nand off %#x size %d bytes\n", onenand_cache_off, ONENAND_CACHE_SIZE); |