Skip to contentSkip to conversation

remove useless checks in cifs connect.c

PATCH Dave Jones 2 participants 2 messages Jun 23, 2006

lore
Share & tools
lore

Dave Jones

author
#0 lore raw

The ; at the end of the 2nd if line in this diff caught my eye. On closer inspection the whole line is unnecessary anyway as kfree(NULL) is ok.

Also nuked another one a few lines up.

fs/cifs/connect.c renamed from fs/cifs/connect.c~ +2 -4
@@ -2822,15 +2822,13 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned i
 							    = 0;
 						} /* else no more room so create dummy domain string */
 						else {
-							if(ses->serverDomain)
-								kfree(ses->serverDomain);
+							kfree(ses->serverDomain);
 							ses->serverDomain =
 							    kzalloc(2,
 								    GFP_KERNEL);
 						}
 					} else {	/* no room so create dummy domain and NOS string */
-						if(ses->serverDomain);
-							kfree(ses->serverDomain);
+						kfree(ses->serverDomain);
 						ses->serverDomain =
 						    kzalloc(2, GFP_KERNEL);
 						if(ses->serverNOS)
Signature · 1 line
http://www.codemonkey.org.uk
#1 lore raw

Thanks - I can make this change - but quite soon this whole routine is going away (as well as most of the fs/cifs/connect.c) as the session setup code in fs/cifs/sess.c.

The original SessSetup routines in fs/cifs/connect.c badly needed a rewrite

Steve French
Senior Software Engineer
Linux Technology Center - IBM Austin
phone: 512-838-2294
email: sfrench at-sign us dot ibm dot com

Dave Jones <[email protected]> wrote on 06/22/2006 09:09:42 PM:

fs/cifs/connect.c 2006-06-22 22:07:42.000000000 -0400 CIFSNTLMSSPNegotiateSessSetup(unsigned i · line 2823

Quoted 13 lines

The ; at the end of the 2nd if line in this diff caught my eye. On closer inspection the whole line is unnecessary anyway as kfree(NULL) is ok.

Also nuked another one a few lines up.

fs/cifs/connect.c 2006-06-22 22:07:42.000000000 -0400 renamed from fs/cifs/connect.c~ 2006-06-22 22:07:04.000000000 -0400 +0 -0
@@ -2822,15 +2822,13 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned i
                          = 0;
                   } /* else no more room so create dummy domain string 

*/

fs/cifs/connect.c 2006-06-22 22:07:42.000000000 -0400 CIFSNTLMSSPNegotiateSessSetup(unsigned i · line 2830

Quoted 9 lines
fs/cifs/connect.c 2006-06-22 22:07:42.000000000 -0400 renamed from fs/cifs/connect.c~ 2006-06-22 22:07:04.000000000 -0400 +1 -2
                   else {
-                     if(ses->serverDomain)
-                        kfree(ses->serverDomain);
+                     kfree(ses->serverDomain);
                      ses->serverDomain =
                          kzalloc(2,
                             GFP_KERNEL);
                   }
                } else {   /* no room so create dummy domain and 

NOSstring */

Quoted 9 lines
fs/cifs/connect.c 2006-06-22 22:07:42.000000000 -0400 renamed from fs/cifs/connect.c~ 2006-06-22 22:07:04.000000000 -0400 +1 -2
-                  if(ses->serverDomain);
-                     kfree(ses->serverDomain);
+                  kfree(ses->serverDomain);
                   ses->serverDomain =
                       kzalloc(2, GFP_KERNEL);
                   if(ses->serverNOS)
Signature · 2 lines
-- 
http://www.codemonkey.org.uk