diff mbox series

fs/ocfs2: remove redundant ret variable

Message ID 20220112081408.667411-1-chi.minghao@zte.com.cn (mailing list archive)
State New, archived
Headers show
Series fs/ocfs2: remove redundant ret variable | expand

Commit Message

David Sterba via Ocfs2-devel Jan. 12, 2022, 8:14 a.m. UTC
From: Minghao Chi <chi.minghao@zte.com.cn>

Return value from ocfs2_add_clusters_in_btree() directly instead
of taking this in another redundant variable.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Signed-off-by: CGEL ZTE <cgel.zte@gmail.com>
---
 fs/ocfs2/file.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Joseph Qi Jan. 12, 2022, 11:19 a.m. UTC | #1
This is obviously not right as you remove the extent tree initialization.

Thanks,
Joseph

On 1/12/22 4:14 PM, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> Return value from ocfs2_add_clusters_in_btree() directly instead
> of taking this in another redundant variable.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> Signed-off-by: CGEL ZTE <cgel.zte@gmail.com>
> ---
>  fs/ocfs2/file.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index fc5f780fa235..9a46dcef448c 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -540,15 +540,11 @@ int ocfs2_add_inode_data(struct ocfs2_super *osb,
>  			 struct ocfs2_alloc_context *meta_ac,
>  			 enum ocfs2_alloc_restarted *reason_ret)
>  {
> -	int ret;
>  	struct ocfs2_extent_tree et;
>  
> -	ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), fe_bh);
> -	ret = ocfs2_add_clusters_in_btree(handle, &et, logical_offset,
> +	return ocfs2_add_clusters_in_btree(handle, &et, logical_offset,
>  					  clusters_to_add, mark_unwritten,
>  					  data_ac, meta_ac, reason_ret);
> -
> -	return ret;
>  }
>  
>  static int ocfs2_extend_allocation(struct inode *inode, u32 logical_start,
diff mbox series

Patch

diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index fc5f780fa235..9a46dcef448c 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -540,15 +540,11 @@  int ocfs2_add_inode_data(struct ocfs2_super *osb,
 			 struct ocfs2_alloc_context *meta_ac,
 			 enum ocfs2_alloc_restarted *reason_ret)
 {
-	int ret;
 	struct ocfs2_extent_tree et;
 
-	ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), fe_bh);
-	ret = ocfs2_add_clusters_in_btree(handle, &et, logical_offset,
+	return ocfs2_add_clusters_in_btree(handle, &et, logical_offset,
 					  clusters_to_add, mark_unwritten,
 					  data_ac, meta_ac, reason_ret);
-
-	return ret;
 }
 
 static int ocfs2_extend_allocation(struct inode *inode, u32 logical_start,