From: Farhan Ali Date: Wed, 24 Feb 2021 23:25:53 +0000 (-0800) Subject: mtd: Update fail_addr when erase fails due to bad blocks X-Git-Tag: v2021.10~228^2~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c146de48727da66ea7dc43f12bd41814cff2faa8;p=platform%2Fkernel%2Fu-boot.git mtd: Update fail_addr when erase fails due to bad blocks For all other erase failures, the fail_addr is updated with the failing address. Only in the case of erase failure due to bad block detection, the fail_addr is not updated. This change simply updates the fail_addr for this specific scenario so that it is consistent with the rest of the code. Signed-off-by: Farhan Ali --- diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index 6557fad..3679ee7 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -3559,6 +3559,8 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, pr_warn("%s: attempt to erase a bad block at page 0x%08x\n", __func__, page); instr->state = MTD_ERASE_FAILED; + instr->fail_addr = + ((loff_t)page << chip->page_shift); goto erase_exit; }