Skip to content

Commit b029d79

Browse files
pdgendtkartben
authored andcommitted
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>
1 parent 125389e commit b029d79

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

subsys/debug/coredump/coredump_backend_flash_partition.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -530,10 +530,6 @@ static void coredump_flash_backend_buffer_output(uint8_t *buf, size_t buflen)
530530

531531
(void)memmove(tmp_buf, ptr, copy_sz);
532532

533-
for (i = 0; i < copy_sz; i++) {
534-
backend_ctx.checksum += tmp_buf[i];
535-
}
536-
537533
backend_ctx.error = stream_flash_buffered_write(
538534
&backend_ctx.stream_ctx,
539535
tmp_buf, copy_sz, false);
@@ -542,6 +538,10 @@ static void coredump_flash_backend_buffer_output(uint8_t *buf, size_t buflen)
542538
break;
543539
}
544540

541+
for (i = 0; i < copy_sz; i++) {
542+
backend_ctx.checksum += tmp_buf[i];
543+
}
544+
545545
ptr += copy_sz;
546546
remaining -= copy_sz;
547547
}

0 commit comments

Comments
 (0)