summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/raw/nand_base.c
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2021-11-18 12:46:59 +0100
committerMiquel Raynal <miquel.raynal@bootlin.com>2021-12-09 17:51:59 +0100
commit67b967ddd93d0ed57d392a00f6f90060f0910c0e (patch)
tree7e14f4a0ffe941e5e1dbf883869ed55f0e608f0c /drivers/mtd/nand/raw/nand_base.c
parent00596576a05145a1b5672897a82ef87af00becf4 (diff)
downloadlinux-67b967ddd93d0ed57d392a00f6f90060f0910c0e.tar.bz2
mtd: Introduce an expert mode for forensics and debugging purposes
When developping NAND controller drivers or when debugging filesystem corruptions, it is quite common to need hacking locally into the MTD/NAND core in order to get access to the content of the bad blocks. Instead of having multiple implementations out there let's provide a simple yet effective specific MTD-wide debugfs entry to fully disable these checks on purpose. A warning is added to inform the user when this mode gets enabled. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20211118114659.1282855-1-miquel.raynal@bootlin.com
Diffstat (limited to 'drivers/mtd/nand/raw/nand_base.c')
-rw-r--r--drivers/mtd/nand/raw/nand_base.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index 3d6c6e880520..b3a9bc08b4bb 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -321,6 +321,9 @@ static int nand_isbad_bbm(struct nand_chip *chip, loff_t ofs)
if (nand_region_is_secured(chip, ofs, mtd->erasesize))
return -EIO;
+ if (WARN_ONCE(mtd_expert_analysis_mode, mtd_expert_analysis_warning))
+ return 0;
+
if (chip->legacy.block_bad)
return chip->legacy.block_bad(chip, ofs);