Skip to content

Commit

Permalink
drivers: flash: spi_nor: select largest valid erase operation
Browse files Browse the repository at this point in the history
The spi_nor erase op selection was based on the alignment of the end of
the region to be erased. This prevented larger erase operations being
selected in many cases

See zephyrproject-rtos#60904

Signed-off-by: Joshua Crawford <joshua.crawford@levno.com>
  • Loading branch information
Crzyrndm committed Jul 28, 2023
1 parent 488fd89 commit eefd7ec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/flash/spi_nor.c
Expand Up @@ -775,7 +775,7 @@ static int spi_nor_erase(const struct device *dev, off_t addr, size_t size)

if ((etp->exp != 0)
&& SPI_NOR_IS_ALIGNED(addr, etp->exp)
&& SPI_NOR_IS_ALIGNED(size, etp->exp)
&& (size >= BIT(etp->exp))
&& ((bet == NULL)
|| (etp->exp > bet->exp))) {
bet = etp;
Expand Down

0 comments on commit eefd7ec

Please sign in to comment.