Skip to content

Commit a5ef032

Browse files
committed
f_mount() API is used in both mount and unmount functions but
when mount called f_mount() is doing both register filesystem and also initializing underlying block device, but in case of umount calls f_mount is doing deregister filesystem and it is not deinitializing block device so added the deint() call in umount API to deinitialize underlying block device.
1 parent 15de1aa commit a5ef032

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

storage/filesystem/fat/source/FATFileSystem.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,14 @@ int FATFileSystem::unmount()
330330
}
331331

332332
FRESULT res = f_mount(NULL, _fsid, 0);
333-
_ffs[_id] = NULL;
334-
_id = -1;
333+
if (!res) {
334+
int err = _ffs[_id]->deinit();
335+
if (err) {
336+
return err;
337+
}
338+
_ffs[_id] = NULL;
339+
_id = -1;
340+
}
335341
unlock();
336342
return fat_error_remap(res);
337343
}

0 commit comments

Comments
 (0)