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

From: Markus Elfring
Date: Sat Oct 11 2025 - 07:29:59 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxxxxxxx>
---
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