summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorValdis Kletnieks <valdis.kletnieks@vt.edu>2019-11-11 21:09:56 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-13 00:15:44 +0100
commitad03f80f7b7229f39623f6a11fe8cb07cab1c05e (patch)
treed02ff53658088dedd6ec391de07099722842f5ac /drivers/staging
parent4b18672132332d3ec429ea9370d0b380dae730cd (diff)
staging: exfat: Collapse redundant return code translations
Now that we no longer use odd internal return codes, we can heave the translation code over the side, and just pass the error code back up the call chain. Signed-off-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu> Link: https://lore.kernel.org/r/20191112021000.42091-9-Valdis.Kletnieks@vt.edu Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/exfat/exfat_super.c92
1 files changed, 14 insertions, 78 deletions
diff --git a/drivers/staging/exfat/exfat_super.c b/drivers/staging/exfat/exfat_super.c
index 7941944ec09f..3e13e002cd14 100644
--- a/drivers/staging/exfat/exfat_super.c
+++ b/drivers/staging/exfat/exfat_super.c
@@ -650,7 +650,7 @@ static int ffsCreateFile(struct inode *inode, char *path, u8 mode,
struct uni_name_t uni_name;
struct super_block *sb = inode->i_sb;
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
- int ret;
+ int ret = 0;
/* check the validity of pointer parameters */
if (!fid || !path || (*path == '\0'))
@@ -2366,19 +2366,9 @@ static int exfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,
pr_debug("%s entered\n", __func__);
err = ffsCreateFile(dir, (u8 *)dentry->d_name.name, FM_REGULAR, &fid);
- if (err) {
- if (err == -EINVAL)
- err = -EINVAL;
- else if (err == -EEXIST)
- err = -EEXIST;
- else if (err == -ENOSPC)
- err = -ENOSPC;
- else if (err == -ENAMETOOLONG)
- err = -ENAMETOOLONG;
- else
- err = -EIO;
+ if (err)
goto out;
- }
+
INC_IVERSION(dir);
curtime = current_time(dir);
dir->i_ctime = curtime;
@@ -2543,13 +2533,9 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry)
EXFAT_I(inode)->fid.size = i_size_read(inode);
err = ffsRemoveFile(dir, &(EXFAT_I(inode)->fid));
- if (err) {
- if (err == -EPERM)
- err = -EPERM;
- else
- err = -EIO;
+ if (err)
goto out;
- }
+
INC_IVERSION(dir);
curtime = current_time(dir);
dir->i_mtime = curtime;
@@ -2589,27 +2575,14 @@ static int exfat_symlink(struct inode *dir, struct dentry *dentry,
pr_debug("%s entered\n", __func__);
err = ffsCreateFile(dir, (u8 *)dentry->d_name.name, FM_SYMLINK, &fid);
- if (err) {
- if (err == -EINVAL)
- err = -EINVAL;
- else if (err == -EEXIST)
- err = -EEXIST;
- else if (err == -ENOSPC)
- err = -ENOSPC;
- else
- err = -EIO;
+ if (err)
goto out;
- }
+
err = ffsWriteFile(dir, &fid, (char *)target, len, &ret);
if (err) {
ffsRemoveFile(dir, &fid);
-
- if (err == -ENOSPC)
- err = -ENOSPC;
- else
- err = -EIO;
goto out;
}
@@ -2666,19 +2639,9 @@ static int exfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
pr_debug("%s entered\n", __func__);
err = ffsCreateDir(dir, (u8 *)dentry->d_name.name, &fid);
- if (err) {
- if (err == -EINVAL)
- err = -EINVAL;
- else if (err == -EEXIST)
- err = -EEXIST;
- else if (err == -ENOSPC)
- err = -ENOSPC;
- else if (err == -ENAMETOOLONG)
- err = -ENAMETOOLONG;
- else
- err = -EIO;
+ if (err)
goto out;
- }
+
INC_IVERSION(dir);
curtime = current_time(dir);
dir->i_ctime = curtime;
@@ -2727,19 +2690,9 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
EXFAT_I(inode)->fid.size = i_size_read(inode);
err = ffsRemoveDir(dir, &(EXFAT_I(inode)->fid));
- if (err) {
- if (err == -EINVAL)
- err = -EINVAL;
- else if (err == -EEXIST)
- err = -ENOTEMPTY;
- else if (err == -ENOENT)
- err = -ENOENT;
- else if (err == -EBUSY)
- err = -EBUSY;
- else
- err = -EIO;
+ if (err)
goto out;
- }
+
INC_IVERSION(dir);
curtime = current_time(dir);
dir->i_mtime = curtime;
@@ -2787,21 +2740,9 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry,
err = ffsMoveFile(old_dir, &(EXFAT_I(old_inode)->fid), new_dir,
new_dentry);
- if (err) {
- if (err == -EPERM)
- err = -EPERM;
- else if (err == -EINVAL)
- err = -EINVAL;
- else if (err == -EEXIST)
- err = -EEXIST;
- else if (err == -ENOENT)
- err = -ENOENT;
- else if (err == -ENOSPC)
- err = -ENOSPC;
- else
- err = -EIO;
+ if (err)
goto out;
- }
+
INC_IVERSION(new_dir);
curtime = current_time(new_dir);
new_dir->i_ctime = curtime;
@@ -3161,12 +3102,7 @@ static int exfat_bmap(struct inode *inode, sector_t sector, sector_t *phys,
err = ffsMapCluster(inode, clu_offset, &cluster);
- if (err) {
- if (err == -ENOSPC)
- return -ENOSPC;
- else
- return -EIO;
- } else if (cluster != CLUSTER_32(~0)) {
+ if (!err && (cluster != CLUSTER_32(~0))) {
*phys = START_SECTOR(cluster) + sec_offset;
*mapped_blocks = p_fs->sectors_per_clu - sec_offset;
}