Skip to content

Commit

Permalink
[MTD] [OneNAND] Avoid deadlock in erase callback; release chip lock f…
Browse files Browse the repository at this point in the history
…irst.

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.

This patch mirrors that same change already done for NAND.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
  • Loading branch information
Adrian Hunter authored and David Woodhouse committed Oct 14, 2007
1 parent 30a7eb2 commit 3cd3a86
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/mtd/onenand/onenand_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -1711,13 +1711,14 @@ static int onenand_erase(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 */
onenand_release_device(mtd);

/* Do call back function */
if (!ret)
mtd_erase_callback(instr);

return ret;
}

Expand Down

0 comments on commit 3cd3a86

Please sign in to comment.