Skip to content

Commit c63c71f

Browse files
authored
Merge pull request #1059 from pennam/littlefs2
patches: littlefs2 properly init class variables
2 parents bb28fc0 + ff3b4a6 commit c63c71f

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
From 4c7dfb1748407146b5bc0a4fe05a35aec56918db Mon Sep 17 00:00:00 2001
2+
From: Jamie Smith <jsmith@crackofdawn.onmicrosoft.com>
3+
Date: Thu, 17 Apr 2025 00:37:26 -0700
4+
Subject: [PATCH] littlefs2: Properly init class variables (#451)
5+
6+
* littlefs2: Properly init class variables
7+
8+
* Style fix
9+
---
10+
.../littlefsv2/include/littlefsv2/LittleFileSystem2.h | 6 +++---
11+
storage/filesystem/littlefsv2/source/LittleFileSystem2.cpp | 1 -
12+
2 files changed, 3 insertions(+), 4 deletions(-)
13+
14+
diff --git a/storage/filesystem/littlefsv2/include/littlefsv2/LittleFileSystem2.h b/storage/filesystem/littlefsv2/include/littlefsv2/LittleFileSystem2.h
15+
index d753b3fb11..0d13ef7fb5 100644
16+
--- a/storage/filesystem/littlefsv2/include/littlefsv2/LittleFileSystem2.h
17+
+++ b/storage/filesystem/littlefsv2/include/littlefsv2/LittleFileSystem2.h
18+
@@ -289,9 +289,9 @@ protected:
19+
#endif //!(DOXYGEN_ONLY)
20+
21+
private:
22+
- lfs2_t _lfs; // The actual file system
23+
- struct lfs2_config _config;
24+
- mbed::BlockDevice *_bd; // The block device
25+
+ lfs2_t _lfs{}; // The actual file system
26+
+ struct lfs2_config _config {};
27+
+ mbed::BlockDevice *_bd = nullptr; // The block device
28+
29+
// thread-safe locking
30+
PlatformMutex _mutex;
31+
diff --git a/storage/filesystem/littlefsv2/source/LittleFileSystem2.cpp b/storage/filesystem/littlefsv2/source/LittleFileSystem2.cpp
32+
index ea270a48d3..f5ac519e0b 100644
33+
--- a/storage/filesystem/littlefsv2/source/LittleFileSystem2.cpp
34+
+++ b/storage/filesystem/littlefsv2/source/LittleFileSystem2.cpp
35+
@@ -149,7 +149,6 @@ LittleFileSystem2::LittleFileSystem2(const char *name, BlockDevice *bd,
36+
lfs2_size_t cache_size, lfs2_size_t lookahead_size)
37+
: FileSystem(name)
38+
{
39+
- memset(&_config, 0, sizeof(_config));
40+
_config.block_size = block_size;
41+
_config.block_cycles = block_cycles;
42+
_config.cache_size = cache_size;
43+
--
44+
2.51.0
45+

0 commit comments

Comments
 (0)