Skip to content

Commit

Permalink
settings_fcb: Fix storing the data
Browse files Browse the repository at this point in the history
Change fixes storing the data by adding missing write retry after
the last compression. Without the change error was returned instead
of retrying.

This is manual back-port of zephyrproject-rtos#25518

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
  • Loading branch information
nvlsianpu authored and nashif committed Jun 4, 2020
1 parent 355ba2a commit 7c73965
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions subsys/settings/src/settings_fcb.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,16 @@ static int settings_fcb_save(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 != FCB_ERR_NOSPACE) {
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;
Expand Down

0 comments on commit 7c73965

Please sign in to comment.