linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs: Remove redundant assignment to busy
@ 2021-05-13 10:51 Jiapeng Chong
  2021-05-14 12:39 ` Brian Foster
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2021-05-13 10:51 UTC (permalink / raw)
  To: djwong; +Cc: linux-xfs, linux-kernel, Jiapeng Chong

Variable busy is set to false, but this value is never read as it is
overwritten or not used later on, hence it is a redundant assignment
and can be removed.

Clean up the following clang-analyzer warning:

fs/xfs/libxfs/xfs_alloc.c:1679:2: warning: Value stored to 'busy' 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/xfs/libxfs/xfs_alloc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
index 82b7cbb..ae46fe6 100644
--- a/fs/xfs/libxfs/xfs_alloc.c
+++ b/fs/xfs/libxfs/xfs_alloc.c
@@ -1676,7 +1676,6 @@ struct xfs_alloc_cur {
 	cnt_cur = xfs_allocbt_init_cursor(args->mp, args->tp, args->agbp,
 		args->agno, XFS_BTNUM_CNT);
 	bno_cur = NULL;
-	busy = false;
 
 	/*
 	 * Look for an entry >= maxlen+alignment-1 blocks.
-- 
1.8.3.1


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

* Re: [PATCH] xfs: Remove redundant assignment to busy
  2021-05-13 10:51 [PATCH] xfs: Remove redundant assignment to busy Jiapeng Chong
@ 2021-05-14 12:39 ` Brian Foster
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Foster @ 2021-05-14 12:39 UTC (permalink / raw)
  To: Jiapeng Chong; +Cc: djwong, linux-xfs, linux-kernel

On Thu, May 13, 2021 at 06:51:18PM +0800, Jiapeng Chong wrote:
> Variable busy is set to false, but this value is never read as it is
> overwritten or not used later on, hence it is a redundant assignment
> and can be removed.
> 
> Clean up the following clang-analyzer warning:
> 
> fs/xfs/libxfs/xfs_alloc.c:1679:2: warning: Value stored to 'busy' 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>
> ---

Part of me wonders whether it would be better to still initialize the
variable where it's defined, assuming that would quiet the code analyzer
(?). Not a big deal either way:

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/xfs/libxfs/xfs_alloc.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
> index 82b7cbb..ae46fe6 100644
> --- a/fs/xfs/libxfs/xfs_alloc.c
> +++ b/fs/xfs/libxfs/xfs_alloc.c
> @@ -1676,7 +1676,6 @@ struct xfs_alloc_cur {
>  	cnt_cur = xfs_allocbt_init_cursor(args->mp, args->tp, args->agbp,
>  		args->agno, XFS_BTNUM_CNT);
>  	bno_cur = NULL;
> -	busy = false;
>  
>  	/*
>  	 * Look for an entry >= maxlen+alignment-1 blocks.
> -- 
> 1.8.3.1
> 


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

end of thread, other threads:[~2021-05-14 12:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13 10:51 [PATCH] xfs: Remove redundant assignment to busy Jiapeng Chong
2021-05-14 12:39 ` Brian Foster

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