[PATCH] isofs: delete unnecessary checks before brelse()

cgel.zte@gmail.com posted 1 patch 3 years, 7 months ago
fs/isofs/inode.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
[PATCH] isofs: delete unnecessary checks before brelse()
Posted by cgel.zte@gmail.com 3 years, 7 months ago
From: Minghao Chi <chi.minghao@zte.com.cn>

The brelse() function tests whether its argument is NULL
and then returns immediately.
Thus remove the tests which are not needed around the shown calls.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 fs/isofs/inode.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 88bf20303466..df9d70588b60 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -1277,13 +1277,11 @@ static int isofs_read_level3_size(struct inode *inode)
 	} while (more_entries);
 out:
 	kfree(tmpde);
-	if (bh)
-		brelse(bh);
+	brelse(bh);
 	return 0;
 
 out_nomem:
-	if (bh)
-		brelse(bh);
+	brelse(bh);
 	return -ENOMEM;
 
 out_noread:
@@ -1486,8 +1484,7 @@ static int isofs_read_inode(struct inode *inode, int relocated)
 	ret = 0;
 out:
 	kfree(tmpde);
-	if (bh)
-		brelse(bh);
+	brelse(bh);
 	return ret;
 
 out_badread:
-- 
2.25.1
Re: [PATCH] isofs: delete unnecessary checks before brelse()
Posted by Jan Kara 3 years, 7 months ago
On Fri 19-08-22 08:14:20, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> The brelse() function tests whether its argument is NULL
> and then returns immediately.
> Thus remove the tests which are not needed around the shown calls.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>

Thanks for the cleanup. I have added the patch to my tree.

								Honza

> ---
>  fs/isofs/inode.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
> index 88bf20303466..df9d70588b60 100644
> --- a/fs/isofs/inode.c
> +++ b/fs/isofs/inode.c
> @@ -1277,13 +1277,11 @@ static int isofs_read_level3_size(struct inode *inode)
>  	} while (more_entries);
>  out:
>  	kfree(tmpde);
> -	if (bh)
> -		brelse(bh);
> +	brelse(bh);
>  	return 0;
>  
>  out_nomem:
> -	if (bh)
> -		brelse(bh);
> +	brelse(bh);
>  	return -ENOMEM;
>  
>  out_noread:
> @@ -1486,8 +1484,7 @@ static int isofs_read_inode(struct inode *inode, int relocated)
>  	ret = 0;
>  out:
>  	kfree(tmpde);
> -	if (bh)
> -		brelse(bh);
> +	brelse(bh);
>  	return ret;
>  
>  out_badread:
> -- 
> 2.25.1
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR