Skip to content

Commit 8abda1d

Browse files
DNedicdkalowsk
authored andcommitted
fs: littlefs: Fix cache and lookahead size checks
This fixes an issue where wrong values were checked against block device defaults. Kconfig values are used when no filesystem config values are provided, and the buffers are sized according to the Kconfig values, but the checks were only performed against filesystem config variables. Signed-off-by: Djordje Nedic <[email protected]> (cherry picked from commit 2750492)
1 parent 578251b commit 8abda1d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

subsys/fs/littlefs_fs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -846,16 +846,16 @@ static int littlefs_init_cfg(struct fs_littlefs *fs, int flags)
846846
lcp->read_size = block_size;
847847
lcp->prog_size = block_size;
848848

849-
if (lcp->cache_size < new_cache_size) {
850-
LOG_ERR("Configured cache size is too small: %d < %d", lcp->cache_size,
849+
if (cache_size < new_cache_size) {
850+
LOG_ERR("Configured cache size is too small: %d < %d", cache_size,
851851
new_cache_size);
852852
return -ENOMEM;
853853
}
854854
lcp->cache_size = new_cache_size;
855855

856-
if (lcp->lookahead_size < new_lookahead_size) {
856+
if (lookahead_size < new_lookahead_size) {
857857
LOG_ERR("Configured lookahead size is too small: %d < %d",
858-
lcp->lookahead_size, new_lookahead_size);
858+
lookahead_size, new_lookahead_size);
859859
return -ENOMEM;
860860
}
861861
lcp->lookahead_size = new_lookahead_size;

0 commit comments

Comments
 (0)