fs: Fix fs_statvfs returning 0 when statvfs not implemented The fs_statvfs is supposed to return, as all VFS functions, -ENOTSUP error when underlying file-system driver does not implement the API call. The fs_statvfs was returning 0 for success and when API call is not implemented, which means it is indistinguishable whether stat structure has been filled by diver with any data or not touched at all. Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
diff --git a/subsys/fs/fs.c b/subsys/fs/fs.c index 3296361..f55ff2d 100644 --- a/subsys/fs/fs.c +++ b/subsys/fs/fs.c
@@ -625,11 +625,13 @@ return rc; } - if (mp->fs->statvfs != NULL) { - rc = mp->fs->statvfs(mp, abs_path, stat); - if (rc < 0) { - LOG_ERR("failed get file or dir stat (%d)", rc); - } + CHECKIF(mp->fs->statvfs == NULL) { + return -ENOTSUP; + } + + rc = mp->fs->statvfs(mp, abs_path, stat); + if (rc < 0) { + LOG_ERR("failed get file or dir stat (%d)", rc); } return rc;