Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49defc01 authored by David Woodhouse's avatar David Woodhouse
Browse files

[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: default avatarDavid Woodhouse <dwmw2@infradead.org>
parent 1fcf8ce5
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -2069,13 +2069,14 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
 erase_exit:
 erase_exit:


	ret = instr->state == MTD_ERASE_DONE ? 0 : -EIO;
	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 */
	/* Deselect and wake up anyone waiting on the device */
	nand_release_device(mtd);
	nand_release_device(mtd);


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

	/*
	/*
	 * If BBT requires refresh and erase was successful, rewrite any
	 * If BBT requires refresh and erase was successful, rewrite any
	 * selected bad block tables
	 * selected bad block tables