settings_fcb: Fix storing the data
Change fixes storing the data by adding missing write retry after the last compression. Without the change error was returned instead of retrying. Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
This commit is contained in:
parent
bfb56c5e20
commit
775b2457d7
1 changed files with 6 additions and 2 deletions
|
@ -317,12 +317,16 @@ static int settings_fcb_save_priv(struct settings_store *cs, const char *name,
|
|||
wbs = cf->cf_fcb.f_align;
|
||||
len = settings_line_len_calc(name, val_len);
|
||||
|
||||
for (i = 0; i < cf->cf_fcb.f_sector_cnt - 1; i++) {
|
||||
for (i = 0; i < cf->cf_fcb.f_sector_cnt; i++) {
|
||||
rc = fcb_append(&cf->cf_fcb, len, &loc.loc);
|
||||
if (rc != -ENOSPC) {
|
||||
break;
|
||||
}
|
||||
settings_fcb_compress(cf);
|
||||
|
||||
/* FCB can compress up to cf->cf_fcb.f_sector_cnt - 1 times. */
|
||||
if (i < (cf->cf_fcb.f_sector_cnt - 1)) {
|
||||
settings_fcb_compress(cf);
|
||||
}
|
||||
}
|
||||
if (rc) {
|
||||
return -EINVAL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue