From: Vitaly Wool Date: Sat, 16 Sep 2006 19:15:58 +0000 (-0700) Subject: [PATCH] MTD NAND: OOB buffer offset fixups X-Git-Tag: v2.6.18~14^2~3 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=96da96065bd66164acc3c8a1ea6db4ee765537e9;p=linux-2.6-omap-h63xx.git [PATCH] MTD NAND: OOB buffer offset fixups In the case of data-pad-ecc-pad-data... layout the oob start position has to be sizeof(data) in nand_write_oob_syndrom(). In nand_fill_oob() we need to copy to buf + buffer offset instead of buf + write offset. Signed-off-by: Vitaly Wool Signed-off-by: Thomas Gleixner Signed-off-by: David Woodhouse Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index c8cbc00243f..0a54d003ef3 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -1204,7 +1204,7 @@ static int nand_write_oob_syndrome(struct mtd_info *mtd, 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++) { @@ -1567,7 +1567,7 @@ static uint8_t *nand_fill_oob(struct nand_chip *chip, uint8_t *oob, 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;