lkml.org 
[lkml]   [2022]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] btrfs: zoned: Remove redundant initialization of to_add
From
Date


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

\
 
 \ /
  Last update: 2022-01-14 12:07    [W:0.066 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site