Change return code to -ENOMEM from -EINVAL when failing memory allocation in fill_super(), meanwhile delete redundant initial assignment of variable err. Signed-off-by: Chengguang Xu <cgxu519@xxxxxxxxxx> --- fs/ext2/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 1dd62ed..15f26d2 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -756,14 +756,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; - long ret = -EINVAL; + long ret = -ENOMEM; int blocksize = BLOCK_SIZE; int db_count; int i, j; __le32 features; int err; - err = -ENOMEM; sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); if (!sbi) goto failed_unlock; @@ -778,6 +777,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) sbi->s_sb_block = sb_block; spin_lock_init(&sbi->s_lock); + ret = -EINVAL; /* * See what the current blocksize for the device is, and -- 1.8.3.1