ext2: fix type of return value ext2_fill_super()
PATCH 1/2 ext2: fix type of return value ext2_fill_super()
This patch fixes type of return value ext2_fill_super().
Signed-off-by Seunghun Lee <[email protected]>
--- fs/ext2/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext2/super.c +1 -1
@@ -770,7 +770,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)unsigned long logic_sb_block;unsigned long offset =0 ;unsigned long def_mount_opts; -long ret = -EINVAL ; +int ret = -EINVAL ;int blocksize =BLOCK_SIZE ;int db_count;int i, j;
Signature · 1 line
1.7.9.5
PATCH 2/2 ext2: fix error handling in ext2_fill_super()
ext2_fill_super is using err variable, but it is not applied to return value.
This patch fixes it.
Signed-off-by Seunghun Lee <[email protected]>
--- fs/ext2/super.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
fs/ext2/super.c +6 -4
@@ -770,14 +770,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)unsigned long logic_sb_block;unsigned long offset =0 ;unsigned long def_mount_opts; -int ret = -EINVAL ; +int ret = -ENOMEM ;int blocksize =BLOCK_SIZE ;int db_count;int i, j;__le32 features; -int err; +int err =0 ; - err = -ENOMEM ; sbi =kzalloc (sizeof (*sbi),GFP_KERNEL );if (!sbi) goto failed;
@@ -793,6 +792,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)spin_lock_init (&sbi->s_lock); +/* -EINVAL is default */ + ret = -EINVAL ; +/* * See what the current blocksize for the device is, and * use that as the blocksize. Otherwise (or if the blocksize
@@ -1140,7 +1142,7 @@ failed_sbi:kfree (sbi->s_blockgroup_lock);kfree (sbi); failed: -return ret; +return err ? err : ret; }static void ext2_clear_super_error (struct super_block *sb)
Signature · 1 line
1.7.9.5
Re: [PATCH 2/2] ext2: fix error handling in ext2_fill_super()
Quoted 3 lines · Seunghun Lee
ext2_fill_superis using err variable, but it is not applied to return value.This patch fixes it.
I see no point why we should have 'err' and 'ret' variables. Just use
'ret' where 'err' is used and be done with it...
Honza
Quoted 49 lines
Signed-off-by Seunghun Lee <[email protected]>--- fs/ext2/super.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)fs/ext2/super.c +6
-4@@ -770,14 +770,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)unsigned long logic_sb_block;unsigned long offset =0 ;unsigned long def_mount_opts; -int ret = -EINVAL ; +int ret = -ENOMEM ;int blocksize =BLOCK_SIZE ;int db_count;int i, j;__le32 features; -int err; +int err =0 ; - err = -ENOMEM ; sbi =kzalloc (sizeof (*sbi),GFP_KERNEL );if (!sbi) goto failed;@@ -793,6 +792,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)spin_lock_init (&sbi->s_lock); +/* -EINVAL is default */ + ret = -EINVAL ; +/* * See what the current blocksize for the device is, and * use that as the blocksize. Otherwise (or if the blocksize @@ -1140,7 +1142,7 @@ failed_sbi:kfree (sbi->s_blockgroup_lock);kfree (sbi); failed: -return ret; +return err ? err : ret; }static void ext2_clear_super_error (struct super_block *sb)Signature · 1 line
1.7.9.5
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR