diff mbox series

[v3,1/2] mtd: spi-nor: fix select_uniform_erase to skip 0 erase size

Message ID 20220716000643.3541839-1-quic_jaehyoo@quicinc.com
State Superseded
Delegated to: Ambarus Tudor
Headers show
Series [v3,1/2] mtd: spi-nor: fix select_uniform_erase to skip 0 erase size | expand

Commit Message

Jae Hyun Yoo July 16, 2022, 12:06 a.m. UTC
From: Michael Walle <michael@walle.cc>

4bait will set the erase size to 0 if there is no corresponding
opcode for the 4byte erase. Fix spi_nor_select_uniform_erase to skip
the 0 erase size to avoid mtd device registration failure cases.

Reported-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
---
Changes in v3:
 * Added newly in v3.

 drivers/mtd/spi-nor/core.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Tudor Ambarus Nov. 21, 2022, 3:24 p.m. UTC | #1
On Fri, 15 Jul 2022 17:06:42 -0700, Jae Hyun Yoo wrote:
> From: Michael Walle <michael@walle.cc>
> 
> 4bait will set the erase size to 0 if there is no corresponding
> opcode for the 4byte erase. Fix spi_nor_select_uniform_erase to skip
> the 0 erase size to avoid mtd device registration failure cases.
> 
> 
> [...]

Applied [2/2] to spi-nor/next, thanks!
I haven't applied 1/2 as Michael sent a similar patch which
I had already taken at the time I got to your patch set, see:
https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git/commit/?id=39eece67a3cf
Sorry!

[2/2] mtd: spi-nor: winbond: add support for W25Q512NW-IQ
      https://git.kernel.org/mtd/c/ef434f08b056

Best regards,
diff mbox series

Patch

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 502967c76c5f..666ef6ce9549 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -2113,6 +2113,10 @@  spi_nor_select_uniform_erase(struct spi_nor_erase_map *map,
 
 		tested_erase = &map->erase_type[i];
 
+		/* Skip masked erase types. */
+		if (!tested_erase->size)
+			continue;
+
 		/*
 		 * If the current erase size is the one, stop here:
 		 * we have found the right uniform Sector Erase command.