[PATCH] NAND: fix remaining OOB length calculation

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue Jun 20 15:59:02 EDT 2006


Commit:     7e4178f90eec862affc97469118d5008bd1b5bda
Parent:     b6d5ee00e397b20dc88f7ffaa6f7651b71996a5c
commit 7e4178f90eec862affc97469118d5008bd1b5bda
Author:     Vitaly Wool <vwool at ru.mvista.com>
AuthorDate: Wed Jun 7 09:34:37 2006 +0400
Commit:     David Woodhouse <dwmw2 at infradead.org>
CommitDate: Tue Jun 20 20:31:23 2006 +0100

    [PATCH] NAND: fix remaining OOB length calculation
    
    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 at ru.mvista.com>
    Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
---
 drivers/mtd/nand/nand_base.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 77406fc..e74678e 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -883,7 +883,7 @@ static int nand_read_page_syndrome(struc
 	}
 
 	/* 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(str
 	}
 
 	/* Calculate remaining oob bytes */
-	i = oob - chip->oob_poi;
+	i = mtd->oobsize - (oob - chip->oob_poi);
 	if (i)
 		chip->write_buf(mtd, oob, i);
 }



More information about the linux-mtd-cvs mailing list