Commit c37ed2d7 authored by Paulo Alcantara's avatar Paulo Alcantara Committed by Steve French

smb: client: remove extra @chan_count check in __cifs_put_smb_ses()

If @ses->chan_count <= 1, then for-loop body will not be executed so
no need to check it twice.
Reviewed-by: default avatarShyam Prasad N <sprasad@microsoft.com>
Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 4cf6e110
...@@ -1973,9 +1973,10 @@ cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx) ...@@ -1973,9 +1973,10 @@ cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx)
void __cifs_put_smb_ses(struct cifs_ses *ses) void __cifs_put_smb_ses(struct cifs_ses *ses)
{ {
unsigned int rc, xid;
unsigned int chan_count;
struct TCP_Server_Info *server = ses->server; struct TCP_Server_Info *server = ses->server;
unsigned int xid;
size_t i;
int rc;
spin_lock(&ses->ses_lock); spin_lock(&ses->ses_lock);
if (ses->ses_status == SES_EXITING) { if (ses->ses_status == SES_EXITING) {
...@@ -2021,13 +2022,8 @@ void __cifs_put_smb_ses(struct cifs_ses *ses) ...@@ -2021,13 +2022,8 @@ void __cifs_put_smb_ses(struct cifs_ses *ses)
list_del_init(&ses->smb_ses_list); list_del_init(&ses->smb_ses_list);
spin_unlock(&cifs_tcp_ses_lock); spin_unlock(&cifs_tcp_ses_lock);
chan_count = ses->chan_count;
/* close any extra channels */ /* close any extra channels */
if (chan_count > 1) { for (i = 1; i < ses->chan_count; i++) {
int i;
for (i = 1; i < chan_count; i++) {
if (ses->chans[i].iface) { if (ses->chans[i].iface) {
kref_put(&ses->chans[i].iface->refcount, release_iface); kref_put(&ses->chans[i].iface->refcount, release_iface);
ses->chans[i].iface = NULL; ses->chans[i].iface = NULL;
...@@ -2035,7 +2031,6 @@ void __cifs_put_smb_ses(struct cifs_ses *ses) ...@@ -2035,7 +2031,6 @@ void __cifs_put_smb_ses(struct cifs_ses *ses)
cifs_put_tcp_session(ses->chans[i].server, 0); cifs_put_tcp_session(ses->chans[i].server, 0);
ses->chans[i].server = NULL; ses->chans[i].server = NULL;
} }
}
sesInfoFree(ses); sesInfoFree(ses);
cifs_put_tcp_session(server, 0); cifs_put_tcp_session(server, 0);
......
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