summary refs log tree commit diff
path: root/fs/ext2
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@icloud.com>2018-02-26 17:45:12 +0800
committerJan Kara <jack@suse.cz>2018-03-02 14:23:11 +0100
commitd09099051057bbae5e1a887167ad6189ac8bfca4 (patch)
tree82779d25811aed48918168272ccf3c5554c88523 /fs/ext2
parentb72e632c6c7e29343651b0e26539b2e01444dfe6 (diff)
downloadlinux-d09099051057bbae5e1a887167ad6189ac8bfca4.tar.gz
ext2: change return code to -ENOMEM when failing memory allocation
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@icloud.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/super.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 7666c065b96f..de1694512f1f 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -827,7 +827,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;
+	long ret = -ENOMEM;
 	int blocksize = BLOCK_SIZE;
 	int db_count;
 	int i, j;
@@ -835,7 +835,6 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
 	int err;
 	struct ext2_mount_options opts;
 
-	err = -ENOMEM;
 	sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
 	if (!sbi)
 		goto failed;
@@ -851,6 +850,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
 	sbi->s_daxdev = dax_dev;
 
 	spin_lock_init(&sbi->s_lock);
+	ret = -EINVAL;
 
 	/*
 	 * See what the current blocksize for the device is, and