]> err.no Git - linux-2.6/commitdiff
[MTD] [NAND] Avoid deadlock in erase callback; release chip lock first.
authorDavid Woodhouse <dwmw2@infradead.org>
Sat, 6 Oct 2007 19:01:59 +0000 (15:01 -0400)
committerDavid Woodhouse <dwmw2@infradead.org>
Sat, 6 Oct 2007 19:01:59 +0000 (15:01 -0400)
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@infradead.org>
drivers/mtd/nand/nand_base.c

index d5691212058d486b172b6fca73ca8e104bdd3d74..b4e0e7723894749a42752dd0fe26db91bae4743c 100644 (file)
@@ -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