Fix index regression in nand_read_subpage
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Sat Apr 5 02:59:06 EDT 2014
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=4a4163caccae97a23d97c29032664ee7b7a498d0
Commit: 4a4163caccae97a23d97c29032664ee7b7a498d0
Parent: 86e4bbc766b9456f583f2fc3c4f6c623b422af88
Author: Ron <ron at debian.org>
AuthorDate: Sun Mar 16 04:01:07 2014 +1030
Committer: Brian Norris <computersforpeace at gmail.com>
CommitDate: Fri Apr 4 23:13:17 2014 -0700
Fix index regression in nand_read_subpage
Commit 7351d3a5dbf42ba3299af71db3296be447bc1516 added an index variable
as part of fixing checkpatch warnings, presumably as a tool to make some
long lines shorter, however it only set that index in the case of there
being no gaps in eccpos for the fragment being read. Which means the
later step of filling ecccode from oob_poi will use the wrong indexing
into eccpos in that case.
This patch restores the behaviour that existed prior to that change.
Signed-off-by: Ron Lee <ron at debian.org>
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
drivers/mtd/nand/nand_base.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 01946b7..9d01c4d 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1174,13 +1174,14 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
int data_col_addr, i, gaps = 0;
int datafrag_len, eccfrag_len, aligned_len, aligned_pos;
int busw = (chip->options & NAND_BUSWIDTH_16) ? 2 : 1;
- int index = 0;
+ int index;
unsigned int max_bitflips = 0;
/* Column address within the page aligned to ECC size (256bytes) */
start_step = data_offs / chip->ecc.size;
end_step = (data_offs + readlen - 1) / chip->ecc.size;
num_steps = end_step - start_step + 1;
+ index = start_step * chip->ecc.bytes;
/* Data size aligned to ECC ecc.size */
datafrag_len = num_steps * chip->ecc.size;
@@ -1217,8 +1218,6 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
* Send the command to read the particular ECC bytes take care
* about buswidth alignment in read_buf.
*/
- index = start_step * chip->ecc.bytes;
-
aligned_pos = eccpos[index] & ~(busw - 1);
aligned_len = eccfrag_len;
if (eccpos[index] & (busw - 1))
More information about the linux-mtd-cvs
mailing list