[PATCH] fix small nand_base errors

Vitaly Wool vwool at ru.mvista.com
Mon Jul 10 06:56:37 EDT 2006


Hi Thomas,

please find the patch that fixes small nand_base errors inlined.
Brief explanation: for nand_write_oob_syndrome, you should first set the position to eccsize, as OOB starts past the eccsize, not eccsize + chunk.
For nand_fill_oob I guess that's just a typo, otherwise it just doesn't make sense (and OTOH makes this routine write to 0-th OOB byte thus actually marking it as bad).

Best regards,
   Vitaly

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 62b8613..faabca2 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1203,7 +1203,7 @@ static int nand_write_oob_syndrome(struc
 		pos = steps * (eccsize + chunk);
 		steps = 0;
 	} else
-		pos = eccsize + chunk;
+		pos = eccsize;
 
 	chip->cmdfunc(mtd, NAND_CMD_SEQIN, pos, page);
 	for (i = 0; i < steps; i++) {
@@ -1566,7 +1566,7 @@ static uint8_t *nand_fill_oob(struct nan
 				bytes = min_t(size_t, len, free->length);
 				boffs = free->offset;
 			}
-			memcpy(chip->oob_poi + woffs, oob, bytes);
+			memcpy(chip->oob_poi + boffs, oob, bytes);
 			oob += bytes;
 		}
 		return oob;




More information about the linux-mtd mailing list