linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: Colin King <colin.king@canonical.com>, Chris Mason <clm@fb.com>,
	Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>,
	linux-btrfs@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: Remove redundant assignment of variable ret
Date: Fri, 8 Oct 2021 08:35:06 +0800	[thread overview]
Message-ID: <8f48a898-55e3-b539-9c4c-19714d827b2c@oracle.com> (raw)
In-Reply-To: <20211007232716.30456-1-colin.king@canonical.com>

On 08/10/2021 07:27, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable ret is being assigned a value that is never read, it is
> updated later on with a different value. The assignment is redundant and
> can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   fs/btrfs/free-space-cache.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
> index 8ea04582e34b..2a6d02971357 100644
> --- a/fs/btrfs/free-space-cache.c
> +++ b/fs/btrfs/free-space-cache.c
> @@ -735,8 +735,6 @@ static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
>   		return 0;
>   	}
>   
> -	ret = -1;
> -

Essentially we had goto out; when the inode generation check failed few
lines below.  However, the commit a67509c30079 (Btrfs: add an io_ctl
struct and helpers for dealing with the space cache) replaced it with
return 0; and then ret = -1 did not make any sense.

Reviewed-by: Anand Jain <anand.jain@oracle.com>

Thanks, Anand

>   	leaf = path->nodes[0];
>   	header = btrfs_item_ptr(leaf, path->slots[0],
>   				struct btrfs_free_space_header);
> 


      reply	other threads:[~2021-10-08  0:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-07 23:27 [PATCH] btrfs: Remove redundant assignment of variable ret Colin King
2021-10-08  0:35 ` Anand Jain [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=8f48a898-55e3-b539-9c4c-19714d827b2c@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=clm@fb.com \
    --cc=colin.king@canonical.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-janitors@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).