[PATCH 02/13] mtd: spinand: winbond: Generalize the KV OOB layout

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


Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] mtd: spinand: winbond: accidental revert of W25N04LW OOB layout
--

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

mtd: spinand: winbond: Generalize the KV OOB layout

This commit generalizes and renames the W25N02KV OOB layout helpers and
structures to w25nxxkv_kw_ooblayout so it is clearer that all W25NxxKV and
W25NxxKW chips share the same OOB layout.

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

[ ... ]

> @@ -827,7 +819,7 @@ static const struct spinand_info winbond_spinand_table[] = {
>  					      &write_cache_variants,
>  					      &update_cache_variants),
>  		     0,
> -		     SPINAND_ECCINFO(&w25n02kv_ooblayout, w25n02kv_ecc_get_status)),
> +		     SPINAND_ECCINFO(&w25nxxkv_kw_ooblayout, w25n02kv_ecc_get_status)),
>  	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),
> @@ -836,7 +828,7 @@ static const struct spinand_info winbond_spinand_table[] = {
>  					      &write_cache_variants,
>  					      &update_cache_variants),
>  		     0,
> -		     SPINAND_ECCINFO(&w25n08lw_ooblayout, w25n02kv_ecc_get_status)),
> +		     SPINAND_ECCINFO(&w25nxxkv_kw_ooblayout, w25n02kv_ecc_get_status)),

[Severity: High]
Does changing the W25N04LW entry in winbond_spinand_table from
w25n08lw_ooblayout to w25nxxkv_kw_ooblayout accidentally revert the
preceding commit 4c37f4cb3704 ("mtd: spinand: winbond: Fix an OOB layout
inconsistency with W25NxxLW chips")?

That commit specifically switched W25N04LW to w25n08lw_ooblayout so that
w25n08lw_ooblayout_free() exposes only the 12 ECC-protected User Data I
bytes at offset (16 * section) + 4 and w25n08lw_ooblayout_ecc() returns
-ERANGE:

drivers/mtd/nand/spi/winbond.c:w25n08lw_ooblayout_free() {
	if (section > 7)
		return -ERANGE;

	region->offset = (16 * section) + 4;
	region->length = 12;

	return 0;
}

With w25nxxkv_kw_ooblayout assigned here instead, probing a W25N04LW chip
via spinand_init() registers w25nxxkv_kw_ooblayout_free() and
w25nxxkv_kw_ooblayout_ecc(), exposing 14 free OOB bytes starting at offset
(16 * section) + 2 (including unprotected User Data II bytes) and reporting
inaccessible ECC parity regions instead of keeping w25n08lw_ooblayout.

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



More information about the linux-mtd mailing list