[PATCH] smb: client: remove redundant NULL check before kfree()

[email protected] Fri, 3 Jul 2026 17:51:04 +0530
Newsgroups gmane.linux.kernel,gmane.linux.kernel.cifs,gmane.network.samba.internals
Message-ID <[email protected]>
From: Mohammad Shahid <[email protected]>

kfree() safely handles NULL pointers, so the explicit NULL check
before calling kfree() is unnecessary.

This issue was reported by ifnullfree.cocci.

Signed-off-by: Mohammad Shahid <[email protected]>
---
 fs/smb/client/ioctl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/smb/client/ioctl.c b/fs/smb/client/ioctl.c
index 9fa743be3652..2f152d76be7d 100644
--- a/fs/smb/client/ioctl.c
+++ b/fs/smb/client/ioctl.c
@@ -133,8 +133,7 @@ static int cifs_set_compression_by_path(unsigned int xid, struct file *filep,
 
 close:
 	server->ops->close(xid, tcon, &fid);
-	if (tmp_cfile)
-		kfree(tmp_cfile);
+	kfree(tmp_cfile);
 	cifs_free_open_info(&data);
 out:
 	free_dentry_path(page);
-- 
2.43.0