mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #14006 from benpicco/sdcard_fixes
pkg/fs: initialize MTD device before accessing it's properties
This commit is contained in:
commit
adb46b9ee7
@ -124,6 +124,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) {
|
||||
@ -155,7 +161,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)
|
||||
|
@ -124,6 +124,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) {
|
||||
@ -161,7 +167,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)
|
||||
|
@ -109,6 +109,12 @@ static int prepare(spiffs_desc_t *fs_desc)
|
||||
mtd_dev_t *dev = SPIFFS_MTD_DEV;
|
||||
#endif
|
||||
|
||||
int res = mtd_init(dev);
|
||||
|
||||
if (res) {
|
||||
return res;
|
||||
}
|
||||
|
||||
fs_desc->config.hal_read_f = _dev_read;
|
||||
fs_desc->config.hal_write_f = _dev_write;
|
||||
fs_desc->config.hal_erase_f = _dev_erase;
|
||||
@ -129,7 +135,7 @@ static int prepare(spiffs_desc_t *fs_desc)
|
||||
fs_desc->config.phys_erase_block = dev->page_size * dev->pages_per_sector;
|
||||
#endif
|
||||
|
||||
return mtd_init(dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int _format(vfs_mount_t *mountp)
|
||||
|
Loading…
Reference in New Issue
Block a user