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:
Marek Pieta 2020-05-21 05:32:14 -07:00 committed by Carles Cufí
commit 775b2457d7

View file

@ -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;