From 7ca8049f09807004639dc7d44f1476ac6ef7c917 Mon Sep 17 00:00:00 2001 From: Valdis Kletnieks Date: Thu, 24 Oct 2019 11:53:15 -0400 Subject: [PATCH] staging: exfat: Clean up return codes - FFS_PERMISSIONERR Convert FFS_PERMISSIONERR to -EPERM Signed-off-by: Valdis Kletnieks Link: https://lore.kernel.org/r/20191024155327.1095907-5-Valdis.Kletnieks@vt.edu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/exfat/exfat.h | 1 - drivers/staging/exfat/exfat_super.c | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/staging/exfat/exfat.h b/drivers/staging/exfat/exfat.h index f3736b33ca56..a6e0c79ba6a4 100644 --- a/drivers/staging/exfat/exfat.h +++ b/drivers/staging/exfat/exfat.h @@ -217,7 +217,6 @@ static inline u16 get_row_index(u16 i) #define FFS_INVALIDPATH 7 #define FFS_INVALIDFID 8 #define FFS_FILEEXIST 10 -#define FFS_PERMISSIONERR 11 #define FFS_NOTOPENED 12 #define FFS_MAXOPENED 13 #define FFS_EOF 15 diff --git a/drivers/staging/exfat/exfat_super.c b/drivers/staging/exfat/exfat_super.c index 638de11eb625..afa687a786a3 100644 --- a/drivers/staging/exfat/exfat_super.c +++ b/drivers/staging/exfat/exfat_super.c @@ -708,7 +708,7 @@ static int ffsReadFile(struct inode *inode, struct file_id_t *fid, void *buffer, /* check if the given file ID is opened */ if (fid->type != TYPE_FILE) { - ret = FFS_PERMISSIONERR; + ret = -EPERM; goto out; } @@ -838,7 +838,7 @@ static int ffsWriteFile(struct inode *inode, struct file_id_t *fid, /* check if the given file ID is opened */ if (fid->type != TYPE_FILE) { - ret = FFS_PERMISSIONERR; + ret = -EPERM; goto out; } @@ -1085,7 +1085,7 @@ static int ffsTruncateFile(struct inode *inode, u64 old_size, u64 new_size) /* check if the given file ID is opened */ if (fid->type != TYPE_FILE) { - ret = FFS_PERMISSIONERR; + ret = -EPERM; goto out; } @@ -1252,7 +1252,7 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid, /* check if the old file is "." or ".." */ if (p_fs->vol_type != EXFAT) { if ((olddir.dir != p_fs->root_dir) && (dentry < 2)) { - ret = FFS_PERMISSIONERR; + ret = -EPERM; goto out2; } } @@ -1264,7 +1264,7 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid, } if (p_fs->fs_func->get_entry_attr(ep) & ATTR_READONLY) { - ret = FFS_PERMISSIONERR; + ret = -EPERM; goto out2; } @@ -1371,7 +1371,7 @@ static int ffsRemoveFile(struct inode *inode, struct file_id_t *fid) } if (p_fs->fs_func->get_entry_attr(ep) & ATTR_READONLY) { - ret = FFS_PERMISSIONERR; + ret = -EPERM; goto out; } fs_set_vol_flags(sb, VOL_DIRTY); @@ -1953,7 +1953,7 @@ static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry) /* check if the given file ID is opened */ if (fid->type != TYPE_DIR) - return FFS_PERMISSIONERR; + return -EPERM; /* acquire the lock for file system critical section */ down(&p_fs->v_sem); @@ -2151,7 +2151,7 @@ static int ffsRemoveDir(struct inode *inode, struct file_id_t *fid) /* check if the file is "." or ".." */ if (p_fs->vol_type != EXFAT) { if ((dir.dir != p_fs->root_dir) && (dentry < 2)) - return FFS_PERMISSIONERR; + return -EPERM; } /* acquire the lock for file system critical section */ @@ -2532,7 +2532,7 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry) err = ffsRemoveFile(dir, &(EXFAT_I(inode)->fid)); if (err) { - if (err == FFS_PERMISSIONERR) + if (err == -EPERM) err = -EPERM; else err = -EIO; @@ -2752,7 +2752,7 @@ 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 == FFS_PERMISSIONERR) + if (err == -EPERM) err = -EPERM; else if (err == FFS_INVALIDPATH) err = -EINVAL;