Skip to content

Commit 5e02c0b

Browse files
Crzyrndmjgl-meta
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 0b4cd70 commit 5e02c0b

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
@@ -774,7 +774,7 @@ static int spi_nor_erase(const struct device *dev, off_t addr, size_t size)
774774

775775
if ((etp->exp != 0)
776776
&& SPI_NOR_IS_ALIGNED(addr, etp->exp)
777-
&& SPI_NOR_IS_ALIGNED(size, etp->exp)
777+
&& (size >= BIT(etp->exp))
778778
&& ((bet == NULL)
779779
|| (etp->exp > bet->exp))) {
780780
bet = etp;

0 commit comments

Comments
 (0)