Skip to content

Commit

Permalink
params: flash: erase if params not found, assume corrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
dakejahl committed Dec 3, 2024
1 parent b06ff99 commit de3e6aa
Showing 1 changed file with 2 additions and 13 deletions.
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
rv = parameter_flashfs_erase();
}

return rv;
Expand Down

0 comments on commit de3e6aa

Please sign in to comment.