Skip to content
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

params: flash: erase corrupt sector #24065

Merged
merged 2 commits into from
Dec 5, 2024
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
15 changes: 2 additions & 13 deletions src/lib/parameters/flashparams/flashfs32.c
Original file line number Diff line number Diff line change
Expand Up @@ -1126,19 +1126,8 @@ int parameter_flashfs_init(sector_descriptor_t *fconfig, uint8_t *buffer, uint16
/* No paramaters */

if (pf == NULL) {
size_t total_size = size + sizeof(flash_entry_header_t);
size_t alignment = 31;//32-byte flash line - 1
size_t size_adjust = ((total_size + alignment) & ~alignment) - total_size;
total_size += size_adjust;

/* Do we have free space ?*/

if (find_free(total_size) == NULL) {

/* No parameters and no free space => need erase */

rv = parameter_flashfs_erase();
}
// Parameters can't be found, assume sector is corrupt or empty
rv = parameter_flashfs_erase();
}

return rv;
Expand Down
Loading