Skip to content

debug: coredump: coredump_backend_flash: Keep error in context on flush #90596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions subsys/debug/coredump/coredump_backend_flash_partition.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,11 @@ static void coredump_flash_backend_end(void)
}

/* Flush buffer */
backend_ctx.error = stream_flash_buffered_write(
&backend_ctx.stream_ctx,
stream_flash_buf, 0, true);
ret = stream_flash_buffered_write(&backend_ctx.stream_ctx, stream_flash_buf, 0, true);
if (ret != 0) {
LOG_ERR("Cannot flush coredump stream (%d)", ret);
backend_ctx.error = ret;
}

/* Write header */
hdr.size = stream_flash_bytes_written(&backend_ctx.stream_ctx);
Expand Down Expand Up @@ -528,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);
Expand All @@ -540,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;
}
Expand Down
Loading