[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220716000643.3541839-1-quic_jaehyoo@quicinc.com>
Date: Fri, 15 Jul 2022 17:06:42 -0700
From: Jae Hyun Yoo <quic_jaehyoo@...cinc.com>
To: Tudor Ambarus <tudor.ambarus@...rochip.com>,
Pratyush Yadav <p.yadav@...com>,
Michael Walle <michael@...le.cc>
CC: Jamie Iles <quic_jiles@...cinc.com>,
Graeme Gregory <quic_ggregory@...cinc.com>,
Cédric Le Goater <clg@...d.org>,
Jae Hyun Yoo <quic_jaehyoo@...cinc.com>,
<linux-mtd@...ts.infradead.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH v3 1/2] mtd: spi-nor: fix select_uniform_erase to skip 0 erase size
From: Michael Walle <michael@...le.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@...cinc.com>
Signed-off-by: Michael Walle <michael@...le.cc>
Signed-off-by: Jae Hyun Yoo <quic_jaehyoo@...cinc.com>
---
Changes in v3:
* Added newly in v3.
drivers/mtd/spi-nor/core.c | 4 ++++
1 file changed, 4 insertions(+)
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.
--
2.25.1
Powered by blists - more mailing lists