Commit ad03f80f authored by Valdis Kletnieks's avatar Valdis Kletnieks Committed by Greg Kroah-Hartman

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: default avatarValdis Kletnieks <Valdis.Kletnieks@vt.edu>
Link: https://lore.kernel.org/r/20191112021000.42091-9-Valdis.Kletnieks@vt.eduSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4b186721
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment