]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: spi-nor: Skip erase logic when SPI_NOR_NO_ERASE is set
authorTudor Ambarus <tudor.ambarus@microchip.com>
Mon, 28 Feb 2022 16:33:34 +0000 (18:33 +0200)
committerTudor Ambarus <tudor.ambarus@microchip.com>
Tue, 8 Mar 2022 08:36:56 +0000 (10:36 +0200)
commite95e0a2d462d422e8b87c76b8676c0bd89dcee22
tree51dd9995c4991aaae55d31a181375b99511d571c
parent42b623d6be1aca7893f85f2022dc91d525368a1b
mtd: spi-nor: Skip erase logic when SPI_NOR_NO_ERASE is set

Even if SPI_NOR_NO_ERASE was set, one could still send erase opcodes
to the flash. It is not recommended to send unsupported opcodes to
flashes. Fix the logic and do not set mtd->_erase when SPI_NOR_NO_ERASE
is specified. With this users will not be able to issue erase opcodes to
flashes and instead they will recive an -ENOTSUPP error.

Fixes: 051b8533e8ec ("mtd: spi-nor: add the framework for SPI NOR")
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Reviewed-by: Michael Walle <michael@walle.cc>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20220228163334.277730-1-tudor.ambarus@microchip.com
drivers/mtd/spi-nor/core.c