[MTD] [NAND] Avoid deadlock in erase callback; release chip lock first.

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sat Oct 6 15:59:01 EDT 2007


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=49defc015ff58fda46a3afa3462dfdfa69bc8401
Commit:     49defc015ff58fda46a3afa3462dfdfa69bc8401
Parent:     1fcf8ce51e7acc4b66904c4e159690c9467606b5
Author:     David Woodhouse <dwmw2 at infradead.org>
AuthorDate: Sat Oct 6 15:01:59 2007 -0400
Committer:  David Woodhouse <dwmw2 at infradead.org>
CommitDate: Sat Oct 6 15:01:59 2007 -0400

    [MTD] [NAND] Avoid deadlock in erase callback; release chip lock first.
    
    When the erase callback performs some other action on the flash, it's
    highly likely to deadlock unless we actually release the chip lock
    before calling it.
    
    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
 drivers/mtd/nand/nand_base.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index d569121..b4e0e77 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2069,13 +2069,14 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
  erase_exit:
 
 	ret = instr->state == MTD_ERASE_DONE ? 0 : -EIO;
-	/* Do call back function */
-	if (!ret)
-		mtd_erase_callback(instr);
 
 	/* Deselect and wake up anyone waiting on the device */
 	nand_release_device(mtd);
 
+	/* Do call back function */
+	if (!ret)
+		mtd_erase_callback(instr);
+
 	/*
 	 * If BBT requires refresh and erase was successful, rewrite any
 	 * selected bad block tables



More information about the linux-mtd-cvs mailing list