diff options
author | Mariusz Kozlowski <m.kozlowski@tuxland.pl> | 2007-10-03 12:41:24 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2007-10-03 12:41:24 -0400 |
commit | a8a11d399fc3c70f2aa645c7472235a06e8b8efa (patch) | |
tree | 035ed3bc8a5b4a1fbce73c04f5dad979f340f07b /fs | |
parent | 9b22b0b726c6e46048767728a0900c8c05f93c21 (diff) |
[CIFS] remove some redundant argument checks
This patch does kmalloc + memset conversion to kzalloc and removes some
redundant argument checks.
Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/connect.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 21cac15ed9a..fc3a851357f 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -673,9 +673,8 @@ multi_t2_fnd: | |||
673 | server->ssocket = NULL; | 673 | server->ssocket = NULL; |
674 | } | 674 | } |
675 | /* buffer usuallly freed in free_mid - need to free it here on exit */ | 675 | /* buffer usuallly freed in free_mid - need to free it here on exit */ |
676 | if (bigbuf != NULL) | 676 | cifs_buf_release(bigbuf); |
677 | cifs_buf_release(bigbuf); | 677 | if (smallbuf) /* no sense logging a debug message if NULL */ |
678 | if (smallbuf != NULL) | ||
679 | cifs_small_buf_release(smallbuf); | 678 | cifs_small_buf_release(smallbuf); |
680 | 679 | ||
681 | read_lock(&GlobalSMBSeslock); | 680 | read_lock(&GlobalSMBSeslock); |
@@ -1910,8 +1909,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1910 | return rc; | 1909 | return rc; |
1911 | } | 1910 | } |
1912 | 1911 | ||
1913 | srvTcp = kmalloc(sizeof (struct TCP_Server_Info), GFP_KERNEL); | 1912 | srvTcp = kzalloc(sizeof(struct TCP_Server_Info), GFP_KERNEL); |
1914 | if (srvTcp == NULL) { | 1913 | if (!srvTcp) { |
1915 | rc = -ENOMEM; | 1914 | rc = -ENOMEM; |
1916 | sock_release(csocket); | 1915 | sock_release(csocket); |
1917 | kfree(volume_info.UNC); | 1916 | kfree(volume_info.UNC); |
@@ -1920,7 +1919,6 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1920 | FreeXid(xid); | 1919 | FreeXid(xid); |
1921 | return rc; | 1920 | return rc; |
1922 | } else { | 1921 | } else { |
1923 | memset(srvTcp, 0, sizeof (struct TCP_Server_Info)); | ||
1924 | memcpy(&srvTcp->addr.sockAddr, &sin_server, | 1922 | memcpy(&srvTcp->addr.sockAddr, &sin_server, |
1925 | sizeof (struct sockaddr_in)); | 1923 | sizeof (struct sockaddr_in)); |
1926 | atomic_set(&srvTcp->inFlight, 0); | 1924 | atomic_set(&srvTcp->inFlight, 0); |
@@ -2529,8 +2527,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2529 | sesssetup_nomem: /* do not return an error on nomem for the info strings, | 2527 | sesssetup_nomem: /* do not return an error on nomem for the info strings, |
2530 | since that could make reconnection harder, and | 2528 | since that could make reconnection harder, and |
2531 | reconnection might be needed to free memory */ | 2529 | reconnection might be needed to free memory */ |
2532 | if (smb_buffer) | 2530 | cifs_buf_release(smb_buffer); |
2533 | cifs_buf_release(smb_buffer); | ||
2534 | 2531 | ||
2535 | return rc; | 2532 | return rc; |
2536 | } | 2533 | } |
@@ -2868,8 +2865,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2868 | rc = -EIO; | 2865 | rc = -EIO; |
2869 | } | 2866 | } |
2870 | 2867 | ||
2871 | if (smb_buffer) | 2868 | cifs_buf_release(smb_buffer); |
2872 | cifs_buf_release(smb_buffer); | ||
2873 | 2869 | ||
2874 | return rc; | 2870 | return rc; |
2875 | } | 2871 | } |
@@ -3277,8 +3273,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
3277 | rc = -EIO; | 3273 | rc = -EIO; |
3278 | } | 3274 | } |
3279 | 3275 | ||
3280 | if (smb_buffer) | 3276 | cifs_buf_release(smb_buffer); |
3281 | cifs_buf_release(smb_buffer); | ||
3282 | 3277 | ||
3283 | return rc; | 3278 | return rc; |
3284 | } | 3279 | } |
@@ -3446,8 +3441,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, | |||
3446 | ses->ipc_tid = smb_buffer_response->Tid; | 3441 | ses->ipc_tid = smb_buffer_response->Tid; |
3447 | } | 3442 | } |
3448 | 3443 | ||
3449 | if (smb_buffer) | 3444 | cifs_buf_release(smb_buffer); |
3450 | cifs_buf_release(smb_buffer); | ||
3451 | return rc; | 3445 | return rc; |
3452 | } | 3446 | } |
3453 | 3447 | ||