mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>, clm@fb.com
Cc: josef@toxicpanda.com, dsterba@suse.com,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	Abaci Robot <abaci@linux.alibaba.com>
Subject: Re: [PATCH] btrfs: zoned: Remove redundant initialization of to_add
Date: Fri, 14 Jan 2022 13:06:04 +0200	[thread overview]
Message-ID: <db049584-dc23-78ca-9fc7-0d575855b4ed@suse.com> (raw)
In-Reply-To: <20220114104136.3531-1-jiapeng.chong@linux.alibaba.com>



On 14.01.22 г. 12:41, Jiapeng Chong wrote:
> to_add is being initialized to len but this is never read as
> to_add is overwritten later on. Remove the redundant
> initialization.
> 
> Cleans up the following clang-analyzer warning:
> 
> fs/btrfs/extent-tree.c:2769:8: warning: Value stored to 'to_add' during
> its initialization is never read [clang-analyzer-deadcode.DeadStores].

To make it even better it would be good if to_add is define within the
if (!global_rsv->full) branch.

> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  fs/btrfs/extent-tree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index d89273c4b6b8..37117b62d005 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -2766,7 +2766,7 @@ static int unpin_extent_range(struct btrfs_fs_info *fs_info,
>  		spin_unlock(&cache->lock);
>  		if (!readonly && return_free_space &&
>  		    global_rsv->space_info == space_info) {
> -			u64 to_add = len;
> +			u64 to_add;
>  
>  			spin_lock(&global_rsv->lock);
>  			if (!global_rsv->full) {
> 

      reply	other threads:[~2022-01-14 11:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-14 10:41 Jiapeng Chong
2022-01-14 11:06 ` Nikolay Borisov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=db049584-dc23-78ca-9fc7-0d575855b4ed@suse.com \
    --to=nborisov@suse.com \
    --cc=abaci@linux.alibaba.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=jiapeng.chong@linux.alibaba.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®