summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2022-03-26 17:33:04 +0100
committerMiquel Raynal <miquel.raynal@bootlin.com>2022-04-04 10:34:58 +0200
commitf7c48bccf1a0262a763f7e39f28c5c6798f2d6c3 (patch)
treeb2c8d1ff3fbe5185608155cee824658eb48c3ff1 /drivers/mtd/nand
parent54647cd003c08b714474a5b599a147ec6a160486 (diff)
downloadlinux-stable-f7c48bccf1a0262a763f7e39f28c5c6798f2d6c3.tar.gz
linux-stable-f7c48bccf1a0262a763f7e39f28c5c6798f2d6c3.tar.bz2
linux-stable-f7c48bccf1a0262a763f7e39f28c5c6798f2d6c3.zip
mtd: rawnand: print offset instead of page number for bad blocks
This makes printed info consistent with other kernel messages. After scanning NAND BBT create_bbt() prints offset of each bad block. This change makes is easy to verify nand_erase_nand() failure reason. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20220326163304.30806-1-zajec5@gmail.com
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/raw/nand_base.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index 284fff62ac49..6b67b7dfe7ce 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -4502,11 +4502,13 @@ int nand_erase_nand(struct nand_chip *chip, struct erase_info *instr,
len = instr->len;
while (len) {
+ loff_t ofs = (loff_t)page << chip->page_shift;
+
/* Check if we have a bad block, we do not erase bad blocks! */
if (nand_block_checkbad(chip, ((loff_t) page) <<
chip->page_shift, allowbbt)) {
- pr_warn("%s: attempt to erase a bad block at page 0x%08x\n",
- __func__, page);
+ pr_warn("%s: attempt to erase a bad block at 0x%08llx\n",
+ __func__, (unsigned long long)ofs);
ret = -EIO;
goto erase_exit;
}
@@ -4524,8 +4526,7 @@ int nand_erase_nand(struct nand_chip *chip, struct erase_info *instr,
if (ret) {
pr_debug("%s: failed erase, page 0x%08x\n",
__func__, page);
- instr->fail_addr =
- ((loff_t)page << chip->page_shift);
+ instr->fail_addr = ofs;
goto erase_exit;
}