mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][next][V2] ext2: remove redundant assignment to variable desc and variable best_desc
@ 2023-06-30 16:54 Colin Ian King
  2023-07-03 12:45 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2023-06-30 16:54 UTC (permalink / raw)
  To: Jan Kara, linux-ext4; +Cc: kernel-janitors, linux-kernel

Variable desc is being assigned a value that is never read, the exit
via label found immeditely returns with no access to desc. The
assignment is redundant and can be removed. Also remove variable best_desc
since this is not used. Cleans up clang scan muild warning:

fs/ext2/ialloc.c:297:4: warning: Value stored to 'desc' is never
read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---

V2: Also remove best_desc. Kudos to Dan Carpenter for spottin this extra
    janitorial cleanup.

---
 fs/ext2/ialloc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index a4e1d7a9c544..34cd5dc1da23 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -273,7 +273,6 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
 
 	if ((parent == d_inode(sb->s_root)) ||
 	    (EXT2_I(parent)->i_flags & EXT2_TOPDIR_FL)) {
-		struct ext2_group_desc *best_desc = NULL;
 		int best_ndir = inodes_per_group;
 		int best_group = -1;
 
@@ -291,10 +290,8 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
 				continue;
 			best_group = group;
 			best_ndir = le16_to_cpu(desc->bg_used_dirs_count);
-			best_desc = desc;
 		}
 		if (best_group >= 0) {
-			desc = best_desc;
 			group = best_group;
 			goto found;
 		}
-- 
2.39.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][next][V2] ext2: remove redundant assignment to variable desc and variable best_desc
  2023-06-30 16:54 [PATCH][next][V2] ext2: remove redundant assignment to variable desc and variable best_desc Colin Ian King
@ 2023-07-03 12:45 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2023-07-03 12:45 UTC (permalink / raw)
  To: Colin Ian King; +Cc: Jan Kara, linux-ext4, kernel-janitors, linux-kernel

On Fri 30-06-23 17:54:58, Colin Ian King wrote:
> Variable desc is being assigned a value that is never read, the exit
> via label found immeditely returns with no access to desc. The
> assignment is redundant and can be removed. Also remove variable best_desc
> since this is not used. Cleans up clang scan muild warning:
> 
> fs/ext2/ialloc.c:297:4: warning: Value stored to 'desc' is never
> read [deadcode.DeadStores]
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Thanks, I've added the patch to my tree.

								Honza

> ---
> 
> V2: Also remove best_desc. Kudos to Dan Carpenter for spottin this extra
>     janitorial cleanup.
> 
> ---
>  fs/ext2/ialloc.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
> index a4e1d7a9c544..34cd5dc1da23 100644
> --- a/fs/ext2/ialloc.c
> +++ b/fs/ext2/ialloc.c
> @@ -273,7 +273,6 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
>  
>  	if ((parent == d_inode(sb->s_root)) ||
>  	    (EXT2_I(parent)->i_flags & EXT2_TOPDIR_FL)) {
> -		struct ext2_group_desc *best_desc = NULL;
>  		int best_ndir = inodes_per_group;
>  		int best_group = -1;
>  
> @@ -291,10 +290,8 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
>  				continue;
>  			best_group = group;
>  			best_ndir = le16_to_cpu(desc->bg_used_dirs_count);
> -			best_desc = desc;
>  		}
>  		if (best_group >= 0) {
> -			desc = best_desc;
>  			group = best_group;
>  			goto found;
>  		}
> -- 
> 2.39.2
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-03 12:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-30 16:54 [PATCH][next][V2] ext2: remove redundant assignment to variable desc and variable best_desc Colin Ian King
2023-07-03 12:45 ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®