lkml.org 
[lkml]   [2019]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 8/9] staging: exfat: Collapse redundant return code translations
On Mon, Nov 11, 2019 at 09:09:56PM -0500, Valdis Kletnieks wrote:
> 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>
> ---
> drivers/staging/exfat/exfat_super.c | 92 +++++------------------------
> 1 file changed, 14 insertions(+), 78 deletions(-)
>
> diff --git a/drivers/staging/exfat/exfat_super.c b/drivers/staging/exfat/exfat_super.c
> index 5d538593b5f6..a97a61a60517 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;

Why are you adding this initializer? It just disables static analysis
warnings about uninitialized variables and it creates a static analysis
warning about unused assignments.

>
> /* check the validity of pointer parameters */
> if (!fid || !path || (*path == '\0'))

[ snip ]

> @@ -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;
> }


If ffsMapCluster() fails then we return success now. Is that
intentional?

regards,
dan carpener

\
 
 \ /
  Last update: 2019-11-13 19:20    [W:0.049 / U:10.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site