Skip to content

Commit 125389e

Browse files
pdgendtkartben
authored andcommitted
debug: coredump: coredump_backend_flash: Keep error in context on flush
Do not override the last known value in backend_ctx.error with the result of flushing. Any previous error would be cleared and the coredump would appear to have succeeded. Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
1 parent 600cae6 commit 125389e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

subsys/debug/coredump/coredump_backend_flash_partition.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,9 +468,11 @@ static void coredump_flash_backend_end(void)
468468
}
469469

470470
/* Flush buffer */
471-
backend_ctx.error = stream_flash_buffered_write(
472-
&backend_ctx.stream_ctx,
473-
stream_flash_buf, 0, true);
471+
ret = stream_flash_buffered_write(&backend_ctx.stream_ctx, stream_flash_buf, 0, true);
472+
if (ret != 0) {
473+
LOG_ERR("Cannot flush coredump stream (%d)", ret);
474+
backend_ctx.error = ret;
475+
}
474476

475477
/* Write header */
476478
hdr.size = stream_flash_bytes_written(&backend_ctx.stream_ctx);

0 commit comments

Comments
 (0)