[PATCH 0/2] mtd: spinand: fix nand-no-ecc-engine support
From: Nuno Sá
Date: Mon Aug 31 2026 - 14:14:55 EST
Setting "nand-no-ecc-engine" in DT currently oopses at probe: SPI-NAND
dereferences nand->ecc.engine unconditionally to test for a pipelined
engine, but nanddev_get_ecc_engine() leaves that pointer NULL when no
engine is requested. Patch 1 adds a nand_ecc_is_pipelined() helper to
the NAND core that folds in the NULL check, and uses it at the three
affected sites.
With the oops out of the way the device probes, but registers an MTD
advertising zero available OOB bytes. That makes every MTD_OPS_AUTO_OOB
access fail with -EINVAL, and JFFS2 refuse to mount. Patch 2 installs
the fallback ooblayout and counts the free bytes unconditionally.
---
Nuno Sá (2):
mtd: spinand: fix NULL pointer dereference with no ECC engine
mtd: spinand: fix zero oobavail when no ECC engine is used
drivers/mtd/nand/ecc.c | 7 +++++++
drivers/mtd/nand/spi/core.c | 21 ++++++++++++---------
include/linux/mtd/nand.h | 2 ++
3 files changed, 21 insertions(+), 9 deletions(-)
---
base-commit: 15a3cbce32994141252bb4ecfe3ff3a5d22d0b4f
change-id: 20260831-mtd-nand-no-ecc-fixes-6341fbbeb059
--
Thanks!
- Nuno Sá