diff --git a/extmod/modos.c b/extmod/modos.c index eda359b97b..7f1e31fba7 100644 --- a/extmod/modos.c +++ b/extmod/modos.c @@ -76,8 +76,9 @@ static mp_obj_t mp_os_sync(void) { #if MICROPY_VFS_FAT for (mp_vfs_mount_t *vfs = MP_STATE_VM(vfs_mount_table); vfs != NULL; vfs = vfs->next) { - // this assumes that vfs->obj is fs_user_mount_t with block device functions - disk_ioctl(MP_OBJ_TO_PTR(vfs->obj), CTRL_SYNC, NULL); + if (mp_obj_is_type(vfs->obj, &mp_fat_vfs_type)) { + disk_ioctl(MP_OBJ_TO_PTR(vfs->obj), CTRL_SYNC, NULL); + } } #endif return mp_const_none;