Skip to content

Commit a13d1b5

Browse files
Oliver Joosdpgeorge
authored andcommitted
extmod/vfs: Raise OSError(ENODEV) if mounting bdev without a filesystem.
This commit prevents uos.mount() from raising an AttributeError. vfs_autodetect() is supposed to return an object that has a "mount" method, so if no filesystem is found it should raise an OSError(ENODEV) and not return the bdev itself which has no "mount" method.
1 parent dc1fd4d commit a13d1b5

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

extmod/vfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ STATIC mp_obj_t mp_vfs_autodetect(mp_obj_t bdev_obj) {
191191
return mp_fat_vfs_type.make_new(&mp_fat_vfs_type, 1, 0, &bdev_obj);
192192
#endif
193193

194-
return bdev_obj;
194+
// no filesystem found
195+
mp_raise_OSError(MP_ENODEV);
195196
}
196197

197198
mp_obj_t mp_vfs_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {

0 commit comments

Comments
 (0)