debug: coredump: coredump_backend_flash: Update checksum only on success
If the flash stream API fails to write a buffer, exclude it from the calculated checksum. Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This commit is contained in:
parent
125389ea32
commit
b029d792c6
@ -530,10 +530,6 @@ static void coredump_flash_backend_buffer_output(uint8_t *buf, size_t buflen)
|
||||
|
||||
(void)memmove(tmp_buf, ptr, copy_sz);
|
||||
|
||||
for (i = 0; i < copy_sz; i++) {
|
||||
backend_ctx.checksum += tmp_buf[i];
|
||||
}
|
||||
|
||||
backend_ctx.error = stream_flash_buffered_write(
|
||||
&backend_ctx.stream_ctx,
|
||||
tmp_buf, copy_sz, false);
|
||||
@ -542,6 +538,10 @@ static void coredump_flash_backend_buffer_output(uint8_t *buf, size_t buflen)
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; i < copy_sz; i++) {
|
||||
backend_ctx.checksum += tmp_buf[i];
|
||||
}
|
||||
|
||||
ptr += copy_sz;
|
||||
remaining -= copy_sz;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user