All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: scrub: Remove redundant initialization of increment
@ 2022-01-21 11:42 Jiapeng Chong
  2022-01-24 19:43 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2022-01-21 11:42 UTC (permalink / raw)
  To: clm; +Cc: josef, dsterba, linux-btrfs, linux-kernel, Jiapeng Chong, Abaci Robot

increment is being initialized to map->stripe_len but this is never
read as increment is overwritten later on. Remove the redundant
initialization.

Cleans up the following clang-analyzer warning:

fs/btrfs/scrub.c:3193:6: warning: Value stored to 'increment' during its
initialization is never read [clang-analyzer-deadcode.DeadStores].

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 fs/btrfs/scrub.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 2e9a322773f2..38f5666eff14 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -3209,7 +3209,6 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
 	offset = 0;
 	nstripes = div64_u64(dev_extent_len, map->stripe_len);
 	mirror_num = 1;
-	increment = map->stripe_len;
 	if (map->type & BTRFS_BLOCK_GROUP_RAID0) {
 		offset = map->stripe_len * stripe_index;
 		increment = map->stripe_len * map->num_stripes;
-- 
2.20.1.7.g153144c


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

* Re: [PATCH] btrfs: scrub: Remove redundant initialization of increment
  2022-01-21 11:42 [PATCH] btrfs: scrub: Remove redundant initialization of increment Jiapeng Chong
@ 2022-01-24 19:43 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2022-01-24 19:43 UTC (permalink / raw)
  To: Jiapeng Chong; +Cc: clm, josef, dsterba, linux-btrfs, linux-kernel, Abaci Robot

On Fri, Jan 21, 2022 at 07:42:24PM +0800, Jiapeng Chong wrote:
> increment is being initialized to map->stripe_len but this is never
> read as increment is overwritten later on. Remove the redundant
> initialization.

> 
> Cleans up the following clang-analyzer warning:
> 
> fs/btrfs/scrub.c:3193:6: warning: Value stored to 'increment' during its
> initialization is never read [clang-analyzer-deadcode.DeadStores].
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  fs/btrfs/scrub.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index 2e9a322773f2..38f5666eff14 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -3209,7 +3209,6 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
>  	offset = 0;
>  	nstripes = div64_u64(dev_extent_len, map->stripe_len);
>  	mirror_num = 1;
> -	increment = map->stripe_len;

I'd rather remove the initialization at the declarataion, the other
values are initialized here so it's all in one place. As is's a minor
change I'll do that at commit time, no need to resend. Thanks.

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

end of thread, other threads:[~2022-01-24 19:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-21 11:42 [PATCH] btrfs: scrub: Remove redundant initialization of increment Jiapeng Chong
2022-01-24 19:43 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.