Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] smb/client: remove redundant NULL check before kfree()
@ 2026-08-16 15:39 Huiwen He
  0 siblings, 0 replies; only message in thread
From: Huiwen He @ 2026-08-16 15:39 UTC (permalink / raw)
  To: smfrench, linkinjeon, pc, ronniesahlberg, sprasad, tom, bharathsm,
	senozhatsky, dhowells, chenxiaosong
  Cc: linux-cifs, lkp

From: Huiwen He <hehuiwen@kylinos.cn>

kfree() accepts NULL pointers, so checking tmp_cfile before freeing it
is unnecessary and triggers a Coccinelle warning.

Remove the redundant check. This does not change runtime behavior.

Fixes: 5693347de107 ("smb/client: use writable handle for FS_IOC_SETFLAGS compression")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202608160402.0ffQDoCg-lkp@intel.com/
Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
---
 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


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

only message in thread, other threads:[~2026-08-16 15:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-16 15:39 [PATCH] smb/client: remove redundant NULL check before kfree() Huiwen He

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox