[PATCH] NAND: fix remaining OOB length calculation
authorVitaly Wool <vwool@ru.mvista.com>
Wed, 7 Jun 2006 05:34:37 +0000 (09:34 +0400)
committerDavid Woodhouse <dwmw2@infradead.org>
Tue, 20 Jun 2006 19:31:23 +0000 (20:31 +0100)
In nand_read_page_syndrome/nand_write_page_syndrome the calculation of
the remaining oob length which is not used by the prepad/ecc/postpad
areas is wrong.

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

index 77406fcf53b37295dec51966af6be4c4da3d8af3..e74678e928cf500b741d9331b1b006c18f837717 100644 (file)
@@ -883,7 +883,7 @@ static int nand_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
        }
 
        /* Calculate remaining oob bytes */
-       i = oob - chip->oob_poi;
+       i = mtd->oobsize - (oob - chip->oob_poi);
        if (i)
                chip->read_buf(mtd, oob, i);
 
@@ -1334,7 +1334,7 @@ static void nand_write_page_syndrome(struct mtd_info *mtd,
        }
 
        /* Calculate remaining oob bytes */
-       i = oob - chip->oob_poi;
+       i = mtd->oobsize - (oob - chip->oob_poi);
        if (i)
                chip->write_buf(mtd, oob, i);
 }