diff mbox series

[next] xfs: remove redundant initializations of pointers drop_leaf and save_leaf

Message ID 20230622093403.2829382-1-colin.i.king@gmail.com (mailing list archive)
State Accepted
Headers show
Series [next] xfs: remove redundant initializations of pointers drop_leaf and save_leaf | expand

Commit Message

Colin Ian King June 22, 2023, 9:34 a.m. UTC
Pointers drop_leaf and save_leaf are initialized with values that are never
read, they are being re-assigned later on just before they are used. Remove
the redundant early initializations and keep the later assignments at the
point where they are used. Cleans up two clang scan build warnings:

fs/xfs/libxfs/xfs_attr_leaf.c:2288:29: warning: Value stored to 'drop_leaf'
during its initialization is never read [deadcode.DeadStores]
fs/xfs/libxfs/xfs_attr_leaf.c:2289:29: warning: Value stored to 'save_leaf'
during its initialization is never read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 fs/xfs/libxfs/xfs_attr_leaf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Darrick J. Wong June 28, 2023, 5:53 p.m. UTC | #1
On Thu, Jun 22, 2023 at 10:34:03AM +0100, Colin Ian King wrote:
> Pointers drop_leaf and save_leaf are initialized with values that are never
> read, they are being re-assigned later on just before they are used. Remove
> the redundant early initializations and keep the later assignments at the
> point where they are used. Cleans up two clang scan build warnings:
> 
> fs/xfs/libxfs/xfs_attr_leaf.c:2288:29: warning: Value stored to 'drop_leaf'
> during its initialization is never read [deadcode.DeadStores]
> fs/xfs/libxfs/xfs_attr_leaf.c:2289:29: warning: Value stored to 'save_leaf'
> during its initialization is never read [deadcode.DeadStores]
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

I'll change this to remove the /second/ initialization below the
variable declarations for a net -2 LOC.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/libxfs/xfs_attr_leaf.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
> index beee51ad75ce..3091d40a1eb6 100644
> --- a/fs/xfs/libxfs/xfs_attr_leaf.c
> +++ b/fs/xfs/libxfs/xfs_attr_leaf.c
> @@ -2285,8 +2285,8 @@ xfs_attr3_leaf_unbalance(
>  	struct xfs_da_state_blk	*drop_blk,
>  	struct xfs_da_state_blk	*save_blk)
>  {
> -	struct xfs_attr_leafblock *drop_leaf = drop_blk->bp->b_addr;
> -	struct xfs_attr_leafblock *save_leaf = save_blk->bp->b_addr;
> +	struct xfs_attr_leafblock *drop_leaf;
> +	struct xfs_attr_leafblock *save_leaf;
>  	struct xfs_attr3_icleaf_hdr drophdr;
>  	struct xfs_attr3_icleaf_hdr savehdr;
>  	struct xfs_attr_leaf_entry *entry;
> -- 
> 2.39.2
>
diff mbox series

Patch

diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
index beee51ad75ce..3091d40a1eb6 100644
--- a/fs/xfs/libxfs/xfs_attr_leaf.c
+++ b/fs/xfs/libxfs/xfs_attr_leaf.c
@@ -2285,8 +2285,8 @@  xfs_attr3_leaf_unbalance(
 	struct xfs_da_state_blk	*drop_blk,
 	struct xfs_da_state_blk	*save_blk)
 {
-	struct xfs_attr_leafblock *drop_leaf = drop_blk->bp->b_addr;
-	struct xfs_attr_leafblock *save_leaf = save_blk->bp->b_addr;
+	struct xfs_attr_leafblock *drop_leaf;
+	struct xfs_attr_leafblock *save_leaf;
 	struct xfs_attr3_icleaf_hdr drophdr;
 	struct xfs_attr3_icleaf_hdr savehdr;
 	struct xfs_attr_leaf_entry *entry;