Commit a8a11d39 authored by Mariusz Kozlowski's avatar Mariusz Kozlowski Committed by Steve French

[CIFS] remove some redundant argument checks

This patch does kmalloc + memset conversion to kzalloc and removes some
redundant argument checks.
Signed-off-by: default avatarMariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 9b22b0b7
...@@ -673,9 +673,8 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) ...@@ -673,9 +673,8 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
server->ssocket = NULL; server->ssocket = NULL;
} }
/* buffer usuallly freed in free_mid - need to free it here on exit */ /* buffer usuallly freed in free_mid - need to free it here on exit */
if (bigbuf != NULL) cifs_buf_release(bigbuf);
cifs_buf_release(bigbuf); if (smallbuf) /* no sense logging a debug message if NULL */
if (smallbuf != NULL)
cifs_small_buf_release(smallbuf); cifs_small_buf_release(smallbuf);
read_lock(&GlobalSMBSeslock); read_lock(&GlobalSMBSeslock);
...@@ -1910,8 +1909,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, ...@@ -1910,8 +1909,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
return rc; return rc;
} }
srvTcp = kmalloc(sizeof (struct TCP_Server_Info), GFP_KERNEL); srvTcp = kzalloc(sizeof(struct TCP_Server_Info), GFP_KERNEL);
if (srvTcp == NULL) { if (!srvTcp) {
rc = -ENOMEM; rc = -ENOMEM;
sock_release(csocket); sock_release(csocket);
kfree(volume_info.UNC); kfree(volume_info.UNC);
...@@ -1920,7 +1919,6 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, ...@@ -1920,7 +1919,6 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
FreeXid(xid); FreeXid(xid);
return rc; return rc;
} else { } else {
memset(srvTcp, 0, sizeof (struct TCP_Server_Info));
memcpy(&srvTcp->addr.sockAddr, &sin_server, memcpy(&srvTcp->addr.sockAddr, &sin_server,
sizeof (struct sockaddr_in)); sizeof (struct sockaddr_in));
atomic_set(&srvTcp->inFlight, 0); atomic_set(&srvTcp->inFlight, 0);
...@@ -2529,8 +2527,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, ...@@ -2529,8 +2527,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
sesssetup_nomem: /* do not return an error on nomem for the info strings, sesssetup_nomem: /* do not return an error on nomem for the info strings,
since that could make reconnection harder, and since that could make reconnection harder, and
reconnection might be needed to free memory */ reconnection might be needed to free memory */
if (smb_buffer) cifs_buf_release(smb_buffer);
cifs_buf_release(smb_buffer);
return rc; return rc;
} }
...@@ -2868,8 +2865,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, ...@@ -2868,8 +2865,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
rc = -EIO; rc = -EIO;
} }
if (smb_buffer) cifs_buf_release(smb_buffer);
cifs_buf_release(smb_buffer);
return rc; return rc;
} }
...@@ -3277,8 +3273,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, ...@@ -3277,8 +3273,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
rc = -EIO; rc = -EIO;
} }
if (smb_buffer) cifs_buf_release(smb_buffer);
cifs_buf_release(smb_buffer);
return rc; return rc;
} }
...@@ -3446,8 +3441,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, ...@@ -3446,8 +3441,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
ses->ipc_tid = smb_buffer_response->Tid; ses->ipc_tid = smb_buffer_response->Tid;
} }
if (smb_buffer) cifs_buf_release(smb_buffer);
cifs_buf_release(smb_buffer);
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment