Skip to content
Commit be0da125 authored by Patrick Delaunay's avatar Patrick Delaunay Committed by Dario Binacchi
Browse files

dfu: mtd: mark bad the MTD block on erase error



In the MTD DFU backend, it is needed to mark the NAND block bad when the
erase failed with the -EIO error, as it is done in UBI and JFFS2 code.

This operation is not done in the MTD framework, but the bad block
tag (in BBM or in BBT) is required to avoid to write data on this block
in the next DFU_OP_WRITE loop in mtd_block_op(): the code skip the bad
blocks, tested by mtd_block_isbad().

Without this patch, when the NAND block become bad on DFU write operation
- low probability on new NAND - the DFU write operation will always failed
because the failing block is never marked bad.

This patch also adds a test to avoid to request an erase operation on a
block already marked bad; this test is not performed in MTD framework
in mtd_erase().

Reviewed-by: default avatarMichael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: default avatarPatrick Delaunay <patrick.delaunay@foss.st.com>
parent 4b1c067e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment