Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion drivers/flash/flash_stm32wba_fm.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static int flash_stm32_erase(const struct device *dev, off_t offset,
size_t len)
{
int rc;
int sect_num = (len / FLASH_PAGE_SIZE) + 1;
int sect_num;

if (!flash_stm32_valid_range(dev, offset, len, true)) {
LOG_ERR("Erase range invalid. Offset: %p, len: %zu",
Expand All @@ -105,6 +105,9 @@ static int flash_stm32_erase(const struct device *dev, off_t offset,
return 0;
}

/* len is a multiple of FLASH_PAGE_SIZE */
sect_num = len / FLASH_PAGE_SIZE;

flash_stm32_sem_take(dev);

LOG_DBG("Erase offset: %p, page: %ld, len: %zu, sect num: %d",
Expand Down
Loading