Skip to contentSkip to conversation

btrfs cleanup: unneeded null check

PATCH New Dan Carpenter 1 participant 1 message Mar 20, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 btrfs cleanup: unneeded null check

old_inode cannot be null here so I removed the check. This fixes a smatch warning:
fs/btrfs/inode.c +5545 btrfs_rename(88) warn: variable dereferenced
before check 'old_inode'

---
linux-next material

fs/btrfs/inode.c +1 -3
index 02bb099..647ce41 100644
@@ -5541,10 +5541,8 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	 * make sure the inode gets flushed if it is replacing
 	 * something.
 	 */
-	if (new_inode && new_inode->i_size &&
-	    old_inode && S_ISREG(old_inode->i_mode)) {
+	if (new_inode && new_inode->i_size && S_ISREG(old_inode->i_mode))
 		btrfs_add_ordered_operation(trans, root, old_inode);
-	}
 
 	old_dir->i_ctime = old_dir->i_mtime = ctime;
 	new_dir->i_ctime = new_dir->i_mtime = ctime;