summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chip/stm32/flash-stm32h7.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/chip/stm32/flash-stm32h7.c b/chip/stm32/flash-stm32h7.c
index ba205a46ed..318d49f133 100644
--- a/chip/stm32/flash-stm32h7.c
+++ b/chip/stm32/flash-stm32h7.c
@@ -187,7 +187,7 @@ int flash_physical_write(int offset, int size, const char *data)
return EC_ERROR_ACCESS_DENIED;
/* work on a single hardware bank at a time */
- if ((offset + size) / HWBANK_SIZE != bank)
+ if ((offset + size - 1) / HWBANK_SIZE != bank)
return EC_ERROR_INVAL;
if (unlock(bank) != EC_SUCCESS)
@@ -257,7 +257,7 @@ int flash_physical_erase(int offset, int size)
return EC_ERROR_ACCESS_DENIED;
/* work on a single hardware bank at a time */
- if ((offset + size) / HWBANK_SIZE != bank)
+ if ((offset + size - 1) / HWBANK_SIZE != bank)
return EC_ERROR_INVAL;
if (unlock(bank) != EC_SUCCESS)