drivers: flash: stm32 ospi driver align erase on sector size
When erasing the flash, the size to erase must be compared to a multiple of SECTOR_SIZE. Signed-off-by: Francois Ramu <francois.ramu@st.com>
This commit is contained in:
parent
5728a6db75
commit
80dd57a49d
1 changed files with 1 additions and 1 deletions
|
@ -723,7 +723,7 @@ static int flash_stm32_ospi_erase(const struct device *dev, off_t addr,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((size != SPI_NOR_SECTOR_SIZE) && (size < dev_cfg->flash_size)) {
|
if (((size % SPI_NOR_SECTOR_SIZE) != 0) && (size < dev_cfg->flash_size)) {
|
||||||
LOG_ERR("Error: wrong sector size 0x%x", size);
|
LOG_ERR("Error: wrong sector size 0x%x", size);
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue