Skip to contentSkip to conversation

btrfs: remove superfluous NULL pointer check in btrfs_rename()

PATCH New Bartlomiej Zolnierkiewicz 1 participant 1 message Aug 6, 2009 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: remove superfluous NULL pointer check in btrfs_rename()

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] btrfs: remove superfluous NULL pointer check in btrfs_rename()

This takes care of the following entry from Dan's list:

fs/btrfs/inode.c +4788 btrfs_rename(36) warning: variable derefenced before check 'old_inode'

---
 fs/btrfs/inode.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/btrfs/inode.c +1 -2
Index: b/fs/btrfs/inode.c
===================================================================
@@ -4785,8 +4785,7 @@ static int btrfs_rename(struct inode *ol
 	 * and the replacement file is large.  Start IO on it now so
 	 * we don't add too much work to the end of the transaction
 	 */
-	if (new_inode && old_inode && S_ISREG(old_inode->i_mode) &&
-	    new_inode->i_size &&
+	if (new_inode && S_ISREG(old_inode->i_mode) && new_inode->i_size &&
 	    old_inode->i_size > BTRFS_ORDERED_OPERATIONS_FLUSH_LIMIT)
 		filemap_flush(old_inode->i_mapping);