[MTD] NAND: Select chip before checking write protect status

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue Jun 27 18:59:01 EDT 2006


Commit:     6a93096195305f6f2a39544a034e77e2e74d5799
Parent:     1887f517e3cdf5f1e9c0e4daaa864450415a8f61
commit 6a93096195305f6f2a39544a034e77e2e74d5799
Author:     Thomas Gleixner <tglx at cruncher.tec.linutronix.de>
AuthorDate: Wed Jun 28 00:11:45 2006 +0200
Commit:     David Woodhouse <dwmw2 at infradead.org>
CommitDate: Tue Jun 27 23:24:09 2006 +0100

    [MTD] NAND: Select chip before checking write protect status
    
    The other way round works not really well with boards which have a
    static NAND chipselect.
    
    Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
 drivers/mtd/nand/nand_base.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 8df184f..80a7665 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1610,13 +1610,13 @@ static int nand_do_write_ops(struct mtd_
 	if (!writelen)
 		return 0;
 
+	chipnr = (int)(to >> chip->chip_shift);
+	chip->select_chip(mtd, chipnr);
+
 	/* Check, if it is write protected */
 	if (nand_check_wp(mtd))
 		return -EIO;
 
-	chipnr = (int)(to >> chip->chip_shift);
-	chip->select_chip(mtd, chipnr);
-
 	realpage = (int)(to >> chip->page_shift);
 	page = realpage & chip->pagemask;
 	blockmask = (1 << (chip->phys_erase_shift - chip->page_shift)) - 1;



More information about the linux-mtd-cvs mailing list