linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: Drop pointless 'source' check from vfs_rename()
@ 2023-07-03 14:43 Jan Kara
  0 siblings, 0 replies; only message in thread
From: Jan Kara @ 2023-07-03 14:43 UTC (permalink / raw)
  To: Christian Brauner
  Cc: Dan Carpenter, linux-fsdevel, Jan Kara, kernel test robot

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 --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);
-- 
2.35.3


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-03 14:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-03 14:43 [PATCH] fs: Drop pointless 'source' check from vfs_rename() Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).