linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: Remove redundant assignment of variable ret
@ 2021-10-07 23:27 Colin King
  2021-10-08  0:35 ` Anand Jain
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2021-10-07 23:27 UTC (permalink / raw)
  To: Chris Mason, Josef Bacik, David Sterba, linux-btrfs
  Cc: kernel-janitors, linux-kernel

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;
-
 	leaf = path->nodes[0];
 	header = btrfs_item_ptr(leaf, path->slots[0],
 				struct btrfs_free_space_header);
-- 
2.32.0


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

* Re: [PATCH] btrfs: Remove redundant assignment of variable ret
  2021-10-07 23:27 [PATCH] btrfs: Remove redundant assignment of variable ret Colin King
@ 2021-10-08  0:35 ` Anand Jain
  0 siblings, 0 replies; 2+ messages in thread
From: Anand Jain @ 2021-10-08  0:35 UTC (permalink / raw)
  To: Colin King, Chris Mason, Josef Bacik, David Sterba, linux-btrfs
  Cc: kernel-janitors, linux-kernel

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);
> 


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

end of thread, other threads:[~2021-10-08  0:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-07 23:27 [PATCH] btrfs: Remove redundant assignment of variable ret Colin King
2021-10-08  0:35 ` Anand Jain

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).