[MTD] NAND: OOB buffer offset fixups
authorVitaly Wool <vwool@ru.mvista.com>
Tue, 11 Jul 2006 07:11:25 +0000 (09:11 +0200)
committerThomas Gleixner <tglx@cruncher.tec.linutronix.de>
Tue, 11 Jul 2006 07:11:25 +0000 (09:11 +0200)
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.

From: Vitaly Wool <vwool@ru.mvista.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
drivers/mtd/nand/nand_base.c

index 62b8613..cffd663 100644 (file)
@@ -1203,7 +1203,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++) {
@@ -1566,7 +1566,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;