diff mbox series

fs: Drop pointless 'source' check from vfs_rename()

Message ID 20230703144306.32639-1-jack@suse.cz (mailing list archive)
State New, archived
Headers show
Series fs: Drop pointless 'source' check from vfs_rename() | expand

Commit Message

Jan Kara July 3, 2023, 2:43 p.m. UTC
The check for 'source' being non-NULL before unlocking it is pointless
as 'source' is guaranteed to exist in vfs_rename(). Drop it.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202307030026.9sE2pk2x-lkp@intel.com/
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/namei.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/fs/namei.c b/fs/namei.c
index 91171da719c5..e56ff39a79bc 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -4874,8 +4874,7 @@  int vfs_rename(struct renamedata *rd)
 			d_exchange(old_dentry, new_dentry);
 	}
 out:
-	if (source)
-		inode_unlock(source);
+	inode_unlock(source);
 	if (target)
 		inode_unlock(target);
 	dput(new_dentry);