[PATCH][next] btrfs: remove redundant initialization of variable dirty

Colin Ian King posted 1 patch 2 years, 4 months ago
fs/btrfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH][next] btrfs: remove redundant initialization of variable dirty
Posted by Colin Ian King 2 years, 4 months ago
The variable dirty is initialized with a value that is never read, it
is being re-assigned later on. Remove the redundant initialization.
Cleans up clang scan build warning:

fs/btrfs/inode.c:5965:7: warning: Value stored to 'dirty' during its
initialization is never read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 fs/btrfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 7d11dbd74956..6441c0053355 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5962,7 +5962,7 @@ static int btrfs_dirty_inode(struct btrfs_inode *inode)
 static int btrfs_update_time(struct inode *inode, int flags)
 {
 	struct btrfs_root *root = BTRFS_I(inode)->root;
-	bool dirty = flags & ~S_VERSION;
+	bool dirty;
 
 	if (btrfs_root_readonly(root))
 		return -EROFS;
-- 
2.39.2
Re: [PATCH][next] btrfs: remove redundant initialization of variable dirty
Posted by David Sterba 2 years, 2 months ago
On Fri, Aug 18, 2023 at 02:55:25PM +0100, Colin Ian King wrote:
> The variable dirty is initialized with a value that is never read, it
> is being re-assigned later on. Remove the redundant initialization.
> Cleans up clang scan build warning:
> 
> fs/btrfs/inode.c:5965:7: warning: Value stored to 'dirty' during its
> initialization is never read [deadcode.DeadStores]
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Added to misc-next, thanks.