Skip to contentSkip to conversation

xfs: Remove redundant assignment to busy

PATCH In review Jiapeng Chong 2 participants 2 messages May 13, 2021 – May 14, 2021 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: Remove redundant assignment to busy

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

---
 fs/xfs/libxfs/xfs_alloc.c | 1 -
 1 file changed, 1 deletion(-)
fs/xfs/libxfs/xfs_alloc.c +0 -1
index 82b7cbb..ae46fe6 100644
@@ -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.
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · 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.

Quoted 8 lines

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

---

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:

Quoted 18 lines
 fs/xfs/libxfs/xfs_alloc.c | 1 -
 1 file changed, 1 deletion(-)
fs/xfs/libxfs/xfs_alloc.c +0 -1
index 82b7cbb..ae46fe6 100644
@@ -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.
Signature · 1 line
1.8.3.1