Skip to content

Commit c37ed2d

Browse files
Paulo AlcantaraSteve French
authored andcommitted
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: Shyam Prasad N <[email protected]> Signed-off-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 4cf6e11 commit c37ed2d

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

fs/smb/client/connect.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1973,9 +1973,10 @@ cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx)
19731973

19741974
void __cifs_put_smb_ses(struct cifs_ses *ses)
19751975
{
1976-
unsigned int rc, xid;
1977-
unsigned int chan_count;
19781976
struct TCP_Server_Info *server = ses->server;
1977+
unsigned int xid;
1978+
size_t i;
1979+
int rc;
19791980

19801981
spin_lock(&ses->ses_lock);
19811982
if (ses->ses_status == SES_EXITING) {
@@ -2021,20 +2022,14 @@ void __cifs_put_smb_ses(struct cifs_ses *ses)
20212022
list_del_init(&ses->smb_ses_list);
20222023
spin_unlock(&cifs_tcp_ses_lock);
20232024

2024-
chan_count = ses->chan_count;
2025-
20262025
/* close any extra channels */
2027-
if (chan_count > 1) {
2028-
int i;
2029-
2030-
for (i = 1; i < chan_count; i++) {
2031-
if (ses->chans[i].iface) {
2032-
kref_put(&ses->chans[i].iface->refcount, release_iface);
2033-
ses->chans[i].iface = NULL;
2034-
}
2035-
cifs_put_tcp_session(ses->chans[i].server, 0);
2036-
ses->chans[i].server = NULL;
2026+
for (i = 1; i < ses->chan_count; i++) {
2027+
if (ses->chans[i].iface) {
2028+
kref_put(&ses->chans[i].iface->refcount, release_iface);
2029+
ses->chans[i].iface = NULL;
20372030
}
2031+
cifs_put_tcp_session(ses->chans[i].server, 0);
2032+
ses->chans[i].server = NULL;
20382033
}
20392034

20402035
sesInfoFree(ses);

0 commit comments

Comments
 (0)