diff mbox series

ext2: change return code to -ENOMEM when failing memory allocation

Message ID 1519638312-196606-1-git-send-email-cgxu519@icloud.com
State Not Applicable, archived
Headers show
Series ext2: change return code to -ENOMEM when failing memory allocation | expand

Commit Message

Chengguang Xu Feb. 26, 2018, 9:45 a.m. UTC
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>
---
 fs/ext2/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jan Kara Feb. 28, 2018, 12:15 p.m. UTC | #1
On Mon 26-02-18 17:45:12, Chengguang Xu wrote:
> 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>

Thanks, I have merged the patch. But please format git changelogs with
lines shorter than 75 characters next time. Thanks!

								Honza

> ---
>  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
>
diff mbox series

Patch

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