public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] fix small nand_base errors
@ 2006-07-10 10:56 Vitaly Wool
  2006-09-13 15:01 ` Vitaly Wool
  0 siblings, 1 reply; 3+ messages in thread
From: Vitaly Wool @ 2006-07-10 10:56 UTC (permalink / raw)
  To: tglx; +Cc: linux-mtd

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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-09-14  9:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-10 10:56 [PATCH] fix small nand_base errors Vitaly Wool
2006-09-13 15:01 ` Vitaly Wool
2006-09-14  9:07   ` tglx

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox