nvs: NVS cache always rebuild on successful NVS initialization

During the NVS initialization, if gc had to be done, the NVS cache
rebuild wasn't called.

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
This commit is contained in:
Julien D'Ascenzio 2023-01-19 13:55:59 +01:00 committed by Carles Cufí
commit b7c2b3fc3a

View file

@ -887,11 +887,13 @@ static int nvs_startup(struct nvs_fs *fs)
fs->data_wra = fs->ate_wra & ADDR_SECT_MASK; fs->data_wra = fs->ate_wra & ADDR_SECT_MASK;
} }
#ifdef CONFIG_NVS_LOOKUP_CACHE
rc = nvs_lookup_cache_rebuild(fs);
#endif
end: end:
#ifdef CONFIG_NVS_LOOKUP_CACHE
if (!rc) {
rc = nvs_lookup_cache_rebuild(fs);
}
#endif
/* If the sector is empty add a gc done ate to avoid having insufficient /* If the sector is empty add a gc done ate to avoid having insufficient
* space when doing gc. * space when doing gc.
*/ */