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:
parent
43fbcaebf9
commit
ac07694309
1 changed files with 3 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue