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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 fs/cifs/sess.c    | 5 -----
 fs/cifs/smb2pdu.c | 5 -----
 2 files changed, 10 deletions(-)

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 e685e4d1f044..1e64175aa5bd 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;
-- 
2.31.1




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux