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:
parent
1b33616535
commit
33f8039d95
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue