Skip to contentSkip to conversation

ksmbd: Avoid duplicate source code in ksmbd_lookup_fd_slow()

PATCH New Markus Elfring 1 participant 1 message Oct 4, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ksmbd: Avoid duplicate source code in ksmbd_lookup_fd_slow()

From: Markus Elfring <[email protected]>
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.

---
 fs/smb/server/vfs_cache.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
fs/smb/server/vfs_cache.c +1 -5
index dfed6fce8904..16b326c4ffcf 100644
@@ -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;
 	}
Signature · 1 line
2.51.0