[PATCH 03/13] mtd: spinand: winbond: Generalize the LW OOB layout

sashiko-bot at kernel.org sashiko-bot at kernel.org
Fri Oct 30 10:51:56 PDT 2026


Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] mtd: spinand: winbond: W25N04LW left using w25nxxkv_kw_ooblayout
--

commit 64760906da7fbc1faf3036caf91cb645ff00e508
Author: Miquel Raynal <miquel.raynal at bootlin.com>

mtd: spinand: winbond: Generalize the LW OOB layout

This commit renames the W25N08LW OOB layout helpers and ops structure to
w25nxxlv_lw_ooblayout* so they can be shared across W25NxxLV and W25NxxLW
chips, and updates w25nxxlv_lw_ooblayout_free() to compute the section limit
from mtd->writesize.

> diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c
> index 4ef30f1a4aa8e..e3be93690bb71 100644
> --- a/drivers/mtd/nand/spi/winbond.c
> +++ b/drivers/mtd/nand/spi/winbond.c

[ ... ]

> @@ -852,7 +855,7 @@ static const struct spinand_info winbond_spinand_table[] = {
>  							&update_cache_variants,
>  							&cont_read_cache_variants),
>  		     0,
> -		     SPINAND_ECCINFO(&w25n08lw_ooblayout, w25n02kv_ecc_get_status),
> +		     SPINAND_ECCINFO(&w25nxxlv_lw_ooblayout, w25n02kv_ecc_get_status),
>  		     SPINAND_CONT_READ(w25n0xjw_set_cont_read)),
>  };

[Severity: Medium]
Should the W25N04LW entry in winbond_spinand_table also be updated to use
w25nxxlv_lw_ooblayout here?

Earlier in this series, commit 4c37f4cb3704 ("mtd: spinand: winbond: Fix an
OOB layout inconsistency with W25NxxLW chips") switched W25N04LW from
w25n02kv_ooblayout to w25n08lw_ooblayout, but the following commit
c7bc36662c75 ("mtd: spinand: winbond: Generalize the KV OOB layout")
replaced it with w25nxxkv_kw_ooblayout:

drivers/mtd/nand/spi/winbond.c:winbond_spinand_table[] {
	...
	SPINAND_INFO("W25N04LW", /* 1.8V */
		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xb2, 0x23),
		     NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
		     NAND_ECCREQ(8, 512),
		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
					      &write_cache_variants,
					      &update_cache_variants),
		     0,
		     SPINAND_ECCINFO(&w25nxxkv_kw_ooblayout, w25n02kv_ecc_get_status)),
	...
}

When a W25N04LW chip is probed, leaving it on w25nxxkv_kw_ooblayout exposes
the 2 non-ECC-protected User Data II bytes per section via
w25nxxkv_kw_ooblayout_free() and reports ECC regions in the upper half of
OOB via w25nxxkv_kw_ooblayout_ecc(), even though the second half of OOB is
not accessible when the on-die ECC engine is enabled.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261030-winbond-master-w25nxxlvw-v1-0-91f67407dc8b@bootlin.com?part=3



More information about the linux-mtd mailing list