[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191113181904.GD3284@kadam>
Date: Wed, 13 Nov 2019 21:19:04 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Valdis Kletnieks <valdis.kletnieks@...edu>
Cc: gregkh@...uxfoundation.org, linux-fsdevel@...r.kernel.org,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [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@...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
Powered by blists - more mailing lists