[PATCH 07/15] staging: exfat: Clean up return codes - FFS_INVALIDPATH

From: Valdis Kletnieks
Date: Thu Oct 24 2019 - 11:54:38 EST


Convert FFS_INVALIDPATH to -EINVAL

Signed-off-by: Valdis Kletnieks <Valdis.Kletnieks@xxxxxx>
---
drivers/staging/exfat/exfat.h | 1 -
drivers/staging/exfat/exfat_core.c | 10 +++++-----
drivers/staging/exfat/exfat_super.c | 10 +++++-----
3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/exfat/exfat.h b/drivers/staging/exfat/exfat.h
index c56363652c5d..00e5e37100ce 100644
--- a/drivers/staging/exfat/exfat.h
+++ b/drivers/staging/exfat/exfat.h
@@ -214,7 +214,6 @@ static inline u16 get_row_index(u16 i)
#define FFS_NOTMOUNTED 4
#define FFS_ALIGNMENTERR 5
#define FFS_SEMAPHOREERR 6
-#define FFS_INVALIDPATH 7
#define FFS_INVALIDFID 8
#define FFS_NOTOPENED 12
#define FFS_MAXOPENED 13
diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c
index ba5680123b0f..23c369fb98e5 100644
--- a/drivers/staging/exfat/exfat_core.c
+++ b/drivers/staging/exfat/exfat_core.c
@@ -2124,7 +2124,7 @@ s32 get_num_entries_and_dos_name(struct super_block *sb, struct chain_t *p_dir,

num_entries = p_fs->fs_func->calc_num_entries(p_uniname);
if (num_entries == 0)
- return FFS_INVALIDPATH;
+ return -EINVAL;

if (p_fs->vol_type != EXFAT) {
nls_uniname_to_dosname(sb, p_dosname, p_uniname, &lossy);
@@ -2136,7 +2136,7 @@ s32 get_num_entries_and_dos_name(struct super_block *sb, struct chain_t *p_dir,
} else {
for (r = reserved_names; *r; r++) {
if (!strncmp((void *)p_dosname->name, *r, 8))
- return FFS_INVALIDPATH;
+ return -EINVAL;
}

if (p_dosname->name_case != 0xFF)
@@ -2257,11 +2257,11 @@ s32 resolve_path(struct inode *inode, char *path, struct chain_t *p_dir,
struct file_id_t *fid = &(EXFAT_I(inode)->fid);

if (strscpy(name_buf, path, sizeof(name_buf)) < 0)
- return FFS_INVALIDPATH;
+ return -EINVAL;

nls_cstring_to_uniname(sb, p_uniname, name_buf, &lossy);
if (lossy)
- return FFS_INVALIDPATH;
+ return -EINVAL;

fid->size = i_size_read(inode);

@@ -2659,7 +2659,7 @@ s32 move_file(struct inode *inode, struct chain_t *p_olddir, s32 oldentry,
/* check if the source and target directory is the same */
if (fs_func->get_entry_type(epmov) == TYPE_DIR &&
fs_func->get_entry_clu0(epmov) == p_newdir->dir)
- return FFS_INVALIDPATH;
+ return -EINVAL;

buf_lock(sb, sector_mov);

diff --git a/drivers/staging/exfat/exfat_super.c b/drivers/staging/exfat/exfat_super.c
index 2c294e238d7b..5b35e3683605 100644
--- a/drivers/staging/exfat/exfat_super.c
+++ b/drivers/staging/exfat/exfat_super.c
@@ -2356,7 +2356,7 @@ static int exfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,

err = ffsCreateFile(dir, (u8 *)dentry->d_name.name, FM_REGULAR, &fid);
if (err) {
- if (err == FFS_INVALIDPATH)
+ if (err == -EINVAL)
err = -EINVAL;
else if (err == -EEXIST)
err = -EEXIST;
@@ -2567,7 +2567,7 @@ static int exfat_symlink(struct inode *dir, struct dentry *dentry,

err = ffsCreateFile(dir, (u8 *)dentry->d_name.name, FM_SYMLINK, &fid);
if (err) {
- if (err == FFS_INVALIDPATH)
+ if (err == -EINVAL)
err = -EINVAL;
else if (err == -EEXIST)
err = -EEXIST;
@@ -2637,7 +2637,7 @@ static int exfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)

err = ffsCreateDir(dir, (u8 *)dentry->d_name.name, &fid);
if (err) {
- if (err == FFS_INVALIDPATH)
+ if (err == -EINVAL)
err = -EINVAL;
else if (err == -EEXIST)
err = -EEXIST;
@@ -2691,7 +2691,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)

err = ffsRemoveDir(dir, &(EXFAT_I(inode)->fid));
if (err) {
- if (err == FFS_INVALIDPATH)
+ if (err == -EINVAL)
err = -EINVAL;
else if (err == -EEXIST)
err = -ENOTEMPTY;
@@ -2748,7 +2748,7 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry,
if (err) {
if (err == -EPERM)
err = -EPERM;
- else if (err == FFS_INVALIDPATH)
+ else if (err == -EINVAL)
err = -EINVAL;
else if (err == -EEXIST)
err = -EEXIST;
--
2.23.0