Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] ksmbd: Avoid duplicate source code in ksmbd_lookup_fd_slow()
@ 2025-10-04 13:40 Markus Elfring
  0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2025-10-04 13:40 UTC (permalink / raw)
  To: linux-cifs, Hyunchul Lee, Namjae Jeon, Sergey Senozhatsky,
	Steve French, Tom Talpey
  Cc: LKML, kernel-janitors, Ronnie Sahlberg, Stefan Metzmacher

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 4 Oct 2025 15:30:16 +0200

Combine two condition checks into one in this function implementation
so that two statements are stored only once in the corresponding branch.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/smb/server/vfs_cache.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/fs/smb/server/vfs_cache.c b/fs/smb/server/vfs_cache.c
index dfed6fce8904..16b326c4ffcf 100644
--- a/fs/smb/server/vfs_cache.c
+++ b/fs/smb/server/vfs_cache.c
@@ -470,11 +470,7 @@ struct ksmbd_file *ksmbd_lookup_fd_slow(struct ksmbd_work *work, u64 id,
 	}
 
 	fp = __ksmbd_lookup_fd(&work->sess->file_table, id);
-	if (!__sanity_check(work->tcon, fp)) {
-		ksmbd_fd_put(work, fp);
-		return NULL;
-	}
-	if (fp->persistent_id != pid) {
+	if (!__sanity_check(work->tcon, fp) || fp->persistent_id != pid) {
 		ksmbd_fd_put(work, fp);
 		return NULL;
 	}
-- 
2.51.0


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

only message in thread, other threads:[~2025-10-04 13:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-04 13:40 [PATCH] ksmbd: Avoid duplicate source code in ksmbd_lookup_fd_slow() Markus Elfring

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