drivers/flash: Fix flash_fill write chunk calculation

Fix incorrect last chunk calculation.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This commit is contained in:
Dominik Ermel 2024-06-04 19:55:48 +02:00 committed by Alberto Escolar
parent 1b33616535
commit 33f8039d95
1 changed files with 1 additions and 1 deletions

View File

@ -48,7 +48,7 @@ int z_impl_flash_fill(const struct device *dev, uint8_t val, off_t offset,
memset(filler, val, sizeof(filler));
while (stored < size) {
size_t chunk = MIN(sizeof(filler), size);
size_t chunk = MIN(sizeof(filler), size - stored);
rc = api->write(dev, offset + stored, filler, chunk);
if (rc < 0) {