[PATCH] smb: client: Delete an unnecessary check before iput() in cifs_do_create()

Markus Elfring posted 1 patch 3 months, 4 weeks ago
fs/smb/client/dir.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] smb: client: Delete an unnecessary check before iput() in cifs_do_create()
Posted by Markus Elfring 3 months, 4 weeks ago
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 11 Oct 2025 13:20:10 +0200

It can be known that the function “iput” performs a null pointer check
for its input parameter.
It is therefore not needed to repeat such a check before its call.

Thus remove a redundant pointer check.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/smb/client/dir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/smb/client/dir.c b/fs/smb/client/dir.c
index 694c362740a9..27dd20003976 100644
--- a/fs/smb/client/dir.c
+++ b/fs/smb/client/dir.c
@@ -450,8 +450,8 @@ static int cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned
 out_err:
 	if (server->ops->close)
 		server->ops->close(xid, tcon, fid);
-	if (newinode)
-		iput(newinode);
+
+	iput(newinode);
 	goto out;
 }
 
-- 
2.51.0