Skip to content

Commit b40ff8a

Browse files
committed
Moved return statements to their own line
1 parent b548fd8 commit b40ff8a

File tree

1 file changed

+42
-21
lines changed

1 file changed

+42
-21
lines changed

features/filesystem/fat/FATFileSystem.cpp

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,48 @@
3535
static int fat_error_remap(FRESULT res)
3636
{
3737
switch(res) {
38-
case FR_OK: return 0; // (0) Succeeded
39-
case FR_DISK_ERR: return -EIO; // (1) A hard error occurred in the low level disk I/O layer
40-
case FR_INT_ERR: return -1; // (2) Assertion failed
41-
case FR_NOT_READY: return -EIO; // (3) The physical drive cannot work
42-
case FR_NO_FILE: return -ENOENT; // (4) Could not find the file
43-
case FR_NO_PATH: return -ENOTDIR; // (5) Could not find the path
44-
case FR_INVALID_NAME: return -EINVAL; // (6) The path name format is invalid
45-
case FR_DENIED: return -EACCES; // (7) Access denied due to prohibited access or directory full
46-
case FR_EXIST: return -EEXIST; // (8) Access denied due to prohibited access
47-
case FR_INVALID_OBJECT: return -EBADF; // (9) The file/directory object is invalid
48-
case FR_WRITE_PROTECTED: return -EACCES; // (10) The physical drive is write protected
49-
case FR_INVALID_DRIVE: return -ENODEV; // (11) The logical drive number is invalid
50-
case FR_NOT_ENABLED: return -ENODEV; // (12) The volume has no work area
51-
case FR_NO_FILESYSTEM: return -EINVAL; // (13) There is no valid FAT volume
52-
case FR_MKFS_ABORTED: return -EIO; // (14) The f_mkfs() aborted due to any problem
53-
case FR_TIMEOUT: return -ETIMEDOUT; // (15) Could not get a grant to access the volume within defined period
54-
case FR_LOCKED: return -EBUSY; // (16) The operation is rejected according to the file sharing policy
55-
case FR_NOT_ENOUGH_CORE: return -ENOMEM; // (17) LFN working buffer could not be allocated
56-
case FR_TOO_MANY_OPEN_FILES: return -ENFILE; // (18) Number of open files > FF_FS_LOCK
57-
case FR_INVALID_PARAMETER: return -EINVAL; // (19) Given parameter is invalid
58-
default: return -res;
38+
case FR_OK: // (0) Succeeded
39+
return 0;
40+
case FR_DISK_ERR: // (1) A hard error occurred in the low level disk I/O layer
41+
return -EIO;
42+
case FR_INT_ERR: // (2) Assertion failed
43+
return -1;
44+
case FR_NOT_READY: // (3) The physical drive cannot work
45+
return -EIO;
46+
case FR_NO_FILE: // (4) Could not find the file
47+
return -ENOENT;
48+
case FR_NO_PATH: // (5) Could not find the path
49+
return -ENOTDIR;
50+
case FR_INVALID_NAME: // (6) The path name format is invalid
51+
return -EINVAL;
52+
case FR_DENIED: // (7) Access denied due to prohibited access or directory full
53+
return -EACCES;
54+
case FR_EXIST: // (8) Access denied due to prohibited access
55+
return -EEXIST;
56+
case FR_INVALID_OBJECT: // (9) The file/directory object is invalid
57+
return -EBADF;
58+
case FR_WRITE_PROTECTED: // (10) The physical drive is write protected
59+
return -EACCES;
60+
case FR_INVALID_DRIVE: // (11) The logical drive number is invalid
61+
return -ENODEV;
62+
case FR_NOT_ENABLED: // (12) The volume has no work area
63+
return -ENODEV;
64+
case FR_NO_FILESYSTEM: // (13) There is no valid FAT volume
65+
return -EINVAL;
66+
case FR_MKFS_ABORTED: // (14) The f_mkfs() aborted due to any problem
67+
return -EIO;
68+
case FR_TIMEOUT: // (15) Could not get a grant to access the volume within defined period
69+
return -ETIMEDOUT;
70+
case FR_LOCKED: // (16) The operation is rejected according to the file sharing policy
71+
return -EBUSY;
72+
case FR_NOT_ENOUGH_CORE: // (17) LFN working buffer could not be allocated
73+
return -ENOMEM;
74+
case FR_TOO_MANY_OPEN_FILES: // (18) Number of open files > FF_FS_LOCK
75+
return -ENFILE;
76+
case FR_INVALID_PARAMETER: // (19) Given parameter is invalid
77+
return -EINVAL;
78+
default:
79+
return -res;
5980
}
6081
}
6182

0 commit comments

Comments
 (0)