storag/stream: fix stream_flash_bytes_written() return value

stream_flash_bytes_written() returned number o bytes physically
written to the flash. This number might be bigger than the requested
number as is aligned to the device write-block-size.

stream_flash_bytes_written() should return number of bytes
written requested by the user.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
This commit is contained in:
Andrzej Puzdrowski 2020-06-12 16:35:02 +02:00 committed by Carles Cufí
commit ac07694309

View file

@ -165,9 +165,12 @@ int stream_flash_buffered_write(struct stream_flash_ctx *ctx, const uint8_t *dat
memset(ctx->buf + ctx->buf_bytes, filler, fill_length);
ctx->buf_bytes += fill_length;
} else {
fill_length = 0;
}
rc = flash_sync(ctx);
ctx->bytes_written -= fill_length;
}
return rc;