diff mbox series

[v2,3/7] cifs: Remove the redundant null pointer check in SMB2_sess_setup()

Message ID 20221029090011.79367-4-zhangxiaoxu5@huawei.com
State New
Headers show
Series cifs: minor code improvements | expand

Commit Message

zhangxiaoxu (A) Oct. 29, 2022, 9 a.m. UTC
The cifs_setup_session() is the only caller of .sess_setup(),
and it's already ensure the server and sess not null, so remove
the redundant nullptr check.

Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
---
 fs/cifs/sess.c    | 5 -----
 fs/cifs/smb2pdu.c | 5 -----
 2 files changed, 10 deletions(-)
diff mbox series

Patch

diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index e08c5f547afb..40e4dd42cc2b 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -1822,11 +1822,6 @@  int CIFS_SessSetup(const unsigned int xid, struct cifs_ses *ses,
 	int rc = 0;
 	struct sess_data *sess_data;
 
-	if (ses == NULL) {
-		WARN(1, "%s: ses == NULL!", __func__);
-		return -EINVAL;
-	}
-
 	sess_data = kzalloc(sizeof(struct sess_data), GFP_KERNEL);
 	if (!sess_data)
 		return -ENOMEM;
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 3a0c34e43a9d..5cda7f029b60 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1676,11 +1676,6 @@  SMB2_sess_setup(const unsigned int xid, struct cifs_ses *ses,
 
 	cifs_dbg(FYI, "Session Setup\n");
 
-	if (!server) {
-		WARN(1, "%s: server is NULL!\n", __func__);
-		return -EIO;
-	}
-
 	sess_data = kzalloc(sizeof(struct SMB2_sess_data), GFP_KERNEL);
 	if (!sess_data)
 		return -ENOMEM;