Skip to content

Commit

Permalink
staging: exfat: Clean up return codes - FFS_ERROR
Browse files Browse the repository at this point in the history
Convert FFS_ERROR to -EINVAL

Signed-off-by: Valdis Kletnieks <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
valdisk authored and gregkh committed Nov 12, 2019
1 parent 7785913 commit 0a7ef8d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
1 change: 0 additions & 1 deletion drivers/staging/exfat/exfat.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ static inline u16 get_row_index(u16 i)
#define FFS_SEMAPHOREERR 6
#define FFS_NOTOPENED 12
#define FFS_MAXOPENED 13
#define FFS_ERROR 19

#define NUM_UPCASE 2918

Expand Down
10 changes: 5 additions & 5 deletions drivers/staging/exfat/exfat_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ void sync_alloc_bitmap(struct super_block *sb)
static s32 __load_upcase_table(struct super_block *sb, sector_t sector,
u32 num_sectors, u32 utbl_checksum)
{
int i, ret = FFS_ERROR;
int i, ret = -EINVAL;
u32 j;
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info);
Expand Down Expand Up @@ -774,7 +774,7 @@ static s32 __load_upcase_table(struct super_block *sb, sector_t sector,
brelse(tmp_bh);
return FFS_SUCCESS;
}
ret = FFS_ERROR;
ret = -EINVAL;
error:
if (tmp_bh)
brelse(tmp_bh);
Expand All @@ -784,7 +784,7 @@ static s32 __load_upcase_table(struct super_block *sb, sector_t sector,

static s32 __load_default_upcase_table(struct super_block *sb)
{
int i, ret = FFS_ERROR;
int i, ret = -EINVAL;
u32 j;
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);

Expand Down Expand Up @@ -1906,7 +1906,7 @@ static s32 __write_partial_entries_in_entry_set(struct super_block *sb,
return FFS_SUCCESS;
err_out:
pr_debug("%s failed\n", __func__);
return FFS_ERROR;
return -EINVAL;
}

/* write back all entries in entry set */
Expand All @@ -1931,7 +1931,7 @@ s32 write_partial_entries_in_entry_set(struct super_block *sb,

/* vaidity check */
if (ep + count > ((struct dentry_t *)&es->__buf) + es->num_entries)
return FFS_ERROR;
return -EINVAL;

dir.dir = GET_CLUSTER_FROM_SECTOR(es->sector);
dir.flags = es->alloc_flag;
Expand Down
20 changes: 10 additions & 10 deletions drivers/staging/exfat/exfat_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ static int ffsGetVolInfo(struct super_block *sb, struct vol_info_t *info)

/* check the validity of pointer parameters */
if (!info)
return FFS_ERROR;
return -EINVAL;

/* acquire the lock for file system critical section */
mutex_lock(&p_fs->v_mutex);
Expand Down Expand Up @@ -561,7 +561,7 @@ static int ffsLookupFile(struct inode *inode, char *path, struct file_id_t *fid)

/* check the validity of pointer parameters */
if (!fid || !path || (*path == '\0'))
return FFS_ERROR;
return -EINVAL;

/* acquire the lock for file system critical section */
mutex_lock(&p_fs->v_mutex);
Expand Down Expand Up @@ -654,7 +654,7 @@ static int ffsCreateFile(struct inode *inode, char *path, u8 mode,

/* check the validity of pointer parameters */
if (!fid || !path || (*path == '\0'))
return FFS_ERROR;
return -EINVAL;

/* acquire the lock for file system critical section */
mutex_lock(&p_fs->v_mutex);
Expand Down Expand Up @@ -703,7 +703,7 @@ static int ffsReadFile(struct inode *inode, struct file_id_t *fid, void *buffer,

/* check the validity of pointer parameters */
if (!buffer)
return FFS_ERROR;
return -EINVAL;

/* acquire the lock for file system critical section */
mutex_lock(&p_fs->v_mutex);
Expand Down Expand Up @@ -835,7 +835,7 @@ static int ffsWriteFile(struct inode *inode, struct file_id_t *fid,

/* check the validity of pointer parameters */
if (!buffer)
return FFS_ERROR;
return -EINVAL;

/* acquire the lock for file system critical section */
mutex_lock(&p_fs->v_mutex);
Expand Down Expand Up @@ -1241,7 +1241,7 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid,

/* check the validity of pointer parameters */
if (!new_path || (*new_path == '\0'))
return FFS_ERROR;
return -EINVAL;

/* acquire the lock for file system critical section */
mutex_lock(&p_fs->v_mutex);
Expand Down Expand Up @@ -1464,7 +1464,7 @@ static int ffsSetAttr(struct inode *inode, u32 attr)
if (p_fs->dev_ejected)
ret = -EIO;
else
ret = FFS_ERROR;
ret = -EINVAL;

if (p_fs->vol_type == EXFAT)
release_entry_set(es);
Expand Down Expand Up @@ -1756,7 +1756,7 @@ static int ffsMapCluster(struct inode *inode, s32 clu_offset, u32 *clu)

/* check the validity of pointer parameters */
if (!clu)
return FFS_ERROR;
return -EINVAL;

/* acquire the lock for file system critical section */
mutex_lock(&p_fs->v_mutex);
Expand Down Expand Up @@ -1908,7 +1908,7 @@ static int ffsCreateDir(struct inode *inode, char *path, struct file_id_t *fid)

/* check the validity of pointer parameters */
if (!fid || !path || (*path == '\0'))
return FFS_ERROR;
return -EINVAL;

/* acquire the lock for file system critical section */
mutex_lock(&p_fs->v_mutex);
Expand Down Expand Up @@ -1954,7 +1954,7 @@ static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry)

/* check the validity of pointer parameters */
if (!dir_entry)
return FFS_ERROR;
return -EINVAL;

/* check if the given file ID is opened */
if (fid->type != TYPE_DIR)
Expand Down

0 comments on commit 0a7ef8d

Please sign in to comment.