mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
pkg/littlefs2: init MTD device before accessing it's parameters
The parameters of the MTD device (`sector_count`, `page_size`) are only known after the device has been initialized. Init the device before using it to avoid reading all 0 on e.g. SD cards.
This commit is contained in:
parent
85a7254326
commit
891a05dca6
@ -132,6 +132,12 @@ static int prepare(littlefs_desc_t *fs)
|
||||
mutex_init(&fs->lock);
|
||||
mutex_lock(&fs->lock);
|
||||
|
||||
int ret = mtd_init(fs->dev);
|
||||
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
memset(&fs->fs, 0, sizeof(fs->fs));
|
||||
|
||||
if (!fs->config.block_count) {
|
||||
@ -169,7 +175,7 @@ static int prepare(littlefs_desc_t *fs)
|
||||
fs->config.prog_buffer = fs->prog_buf;
|
||||
#endif
|
||||
|
||||
return mtd_init(fs->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int _format(vfs_mount_t *mountp)
|
||||
|
Loading…
Reference in New Issue
Block a user