Skip to contentSkip to conversation

fsnotify: remove redundant parameter judgment

PATCH In review Bang Li 2 participants 2 messages Mar 11, 2022 – Mar 14, 2022

Subsystems (2)
lore
Share & tools
lore

Bang Li

author
#0 lore raw

PATCH 1/1 fsnotify: remove redundant parameter judgment

iput() has already judged the incoming parameter, so there is no need to repeat the judgment here.

---
 fs/notify/fsnotify.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
fs/notify/fsnotify.c +2 -4
index 494f653efbc6..70a8516b78bc 100644
@@ -70,8 +70,7 @@ static void fsnotify_unmount_inodes(struct super_block *sb)
 		spin_unlock(&inode->i_lock);
 		spin_unlock(&sb->s_inode_list_lock);
 
-		if (iput_inode)
-			iput(iput_inode);
+		iput(iput_inode);
 
 		/* for each watch, send FS_UNMOUNT and then remove it */
 		fsnotify_inode(inode, FS_UNMOUNT);
@@ -85,8 +84,7 @@ static void fsnotify_unmount_inodes(struct super_block *sb)
 	}
 	spin_unlock(&sb->s_inode_list_lock);
 
-	if (iput_inode)
-		iput(iput_inode);
+	iput(iput_inode);
 }
 
 void fsnotify_sb_delete(struct super_block *sb)
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 4 lines · Bang Li

iput() has already judged the incoming parameter, so there is no need to repeat the judgment here.

Thanks. I've applied the patch to my tree.

Honza

Quoted 31 lines
---
 fs/notify/fsnotify.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
fs/notify/fsnotify.c +2 -4
index 494f653efbc6..70a8516b78bc 100644
@@ -70,8 +70,7 @@ static void fsnotify_unmount_inodes(struct super_block *sb)
 		spin_unlock(&inode->i_lock);
 		spin_unlock(&sb->s_inode_list_lock);
 
-		if (iput_inode)
-			iput(iput_inode);
+		iput(iput_inode);
 
 		/* for each watch, send FS_UNMOUNT and then remove it */
 		fsnotify_inode(inode, FS_UNMOUNT);
@@ -85,8 +84,7 @@ static void fsnotify_unmount_inodes(struct super_block *sb)
 	}
 	spin_unlock(&sb->s_inode_list_lock);
 
-	if (iput_inode)
-		iput(iput_inode);
+	iput(iput_inode);
 }
 
 void fsnotify_sb_delete(struct super_block *sb)
Signature · 1 line
2.25.1
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR