Skip to content

Commit e6f70e9

Browse files
Crzyrndmcfriedt
authored andcommitted
drivers: flash: spi_nor: select largest valid erase operation
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 Closes #60904 Signed-off-by: Joshua Crawford <[email protected]> (cherry picked from commit ea2dd9f)
1 parent f89298c commit e6f70e9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/flash/spi_nor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ static int spi_nor_erase(const struct device *dev, off_t addr, size_t size)
658658

659659
if ((etp->exp != 0)
660660
&& SPI_NOR_IS_ALIGNED(addr, etp->exp)
661-
&& SPI_NOR_IS_ALIGNED(size, etp->exp)
661+
&& (size >= BIT(etp->exp))
662662
&& ((bet == NULL)
663663
|| (etp->exp > bet->exp))) {
664664
bet = etp;

0 commit comments

Comments
 (0)