Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: spi-nor: Report missing SR2 support as -EOPNOTSUPP
@ 2026-12-04 11:08 Miquel Raynal
  2026-12-04 11:23 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Miquel Raynal @ 2026-12-04 11:08 UTC (permalink / raw)
  To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
	Richard Weinberger, Vignesh Raghavendra, Alan Borzeszkowski
  Cc: Thomas Petazzoni, linux-mtd, linux-kernel, stable, Miquel Raynal

Commit 63489002d397 ("mtd: spi-nor: Refactor Read Status/Write Status
support") made spi_nor_read_sr2() return -EINVAL when opcodes.read_sr2
is unset. This does not only happen with flashes lacking SR2, but also
when the controller cannot issue the read opcode.

The OTP NVMEM registration path treats -EOPNOTSUPP as "OTP unsupported"
and ignores it, but not -EINVAL. Probe may therefore fail on Intel SPI
platforms with chips featuring an OTP region.

Return -EOPNOTSUPP instead, restoring the v7.3 behaviour for
spi_nor_otp_is_locked_sr2().

Fixes: 63489002d397 ("mtd: spi-nor: Refactor Read Status/Write Status support")
Cc: stable@vger.kernel.org
Reported-by: Alan Borzeszkowski <alan.borzeszkowski@linux.intel.com>
Closes: https://lore.kernel.org/linux-mtd/111cfeb5ffc603883b6573c62e49675bc3924b0a.camel@linux.intel.com/
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
Build tested only.
---
 drivers/mtd/spi-nor/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index a04d22d2e2e1..2374e1f5fadb 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -842,7 +842,7 @@ int spi_nor_read_sr2(struct spi_nor *nor, u8 *sr2)
 	struct spi_nor_flash_parameter *params = nor->params;
 
 	if (!params->opcodes.read_sr2)
-		return -EINVAL;
+		return -EOPNOTSUPP;
 
 	return spi_nor_read_sr_ll(nor, params->opcodes.read_sr2, sr2, 1);
 }

---
base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
change-id: 20261204-winbond-upstreaming-fix-sr2-einval-972091bb0c1f

Best regards,
-- 
Miquel Raynal <miquel.raynal@bootlin.com>


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-04 11:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 11:08 [PATCH] mtd: spi-nor: Report missing SR2 support as -EOPNOTSUPP Miquel Raynal
2026-12-04 11:23 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox