* [PATCH] mtd: rawnand: print offset instead of page number for bad blocks
@ 2022-03-26 16:33 Rafał Miłecki
2022-04-04 8:47 ` Miquel Raynal
0 siblings, 1 reply; 2+ messages in thread
From: Rafał Miłecki @ 2022-03-26 16:33 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, Rafał Miłecki
From: Rafał Miłecki <rafal@milecki.pl>
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>
---
I noticed this inconsistency while using "flash_erase" tool.
---
drivers/mtd/nand/raw/nand_base.c | 9 +++++----
1 file 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;
}
--
2.34.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mtd: rawnand: print offset instead of page number for bad blocks
2022-03-26 16:33 [PATCH] mtd: rawnand: print offset instead of page number for bad blocks Rafał Miłecki
@ 2022-04-04 8:47 ` Miquel Raynal
0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2022-04-04 8:47 UTC (permalink / raw)
To: Rafał Miłecki, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra
Cc: linux-mtd, Rafał Miłecki
On Sat, 2022-03-26 at 16:33:04 UTC, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
>
> 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>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-04 8:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-26 16:33 [PATCH] mtd: rawnand: print offset instead of page number for bad blocks Rafał Miłecki
2022-04-04 8:47 ` Miquel Raynal
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.