summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorMichael Walle <michael@walle.cc>2022-08-11 00:06:52 +0200
committerTudor Ambarus <tudor.ambarus@microchip.com>2022-11-21 15:37:16 +0200
commit39eece67a3cf027aa5b39d7da5feadc4711504e6 (patch)
tree7eb592f34b579a04482c17cbbb3fae53fed97e5c /drivers/mtd
parentfa06bb26a40ca08fa0d653b04d8ce92d243aa2ce (diff)
downloadlinux-39eece67a3cf027aa5b39d7da5feadc4711504e6.tar.bz2
mtd: spi-nor: fix select_uniform_erase to skip 0 erase size
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: Tudor Ambarus <tudor.ambarus@microchip.com> Link: https://lore.kernel.org/r/20220810220654.1297699-6-michael@walle.cc
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/spi-nor/core.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 1358f3c45d16..2bdc5b50d8da 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -2120,6 +2120,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.