Skip to content

Commit c3a11c0

Browse files
Dan Carpentersmfrench
authored andcommitted
cifs: delete unnecessary NULL checks in cifs_chan_update_iface()
We return early if "iface" is NULL so there is no need to check here. Delete those checks. Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 8a3c4e4 commit c3a11c0

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

fs/smb/client/sess.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -467,27 +467,23 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
467467
kref_put(&old_iface->refcount, release_iface);
468468
} else if (!chan_index) {
469469
/* special case: update interface for primary channel */
470-
if (iface) {
471-
cifs_dbg(FYI, "referencing primary channel iface: %pIS\n",
472-
&iface->sockaddr);
473-
iface->num_channels++;
474-
iface->weight_fulfilled++;
475-
}
470+
cifs_dbg(FYI, "referencing primary channel iface: %pIS\n",
471+
&iface->sockaddr);
472+
iface->num_channels++;
473+
iface->weight_fulfilled++;
476474
}
477475
spin_unlock(&ses->iface_lock);
478476

479-
if (iface) {
480-
spin_lock(&ses->chan_lock);
481-
chan_index = cifs_ses_get_chan_index(ses, server);
482-
if (chan_index == CIFS_INVAL_CHAN_INDEX) {
483-
spin_unlock(&ses->chan_lock);
484-
return 0;
485-
}
486-
487-
ses->chans[chan_index].iface = iface;
477+
spin_lock(&ses->chan_lock);
478+
chan_index = cifs_ses_get_chan_index(ses, server);
479+
if (chan_index == CIFS_INVAL_CHAN_INDEX) {
488480
spin_unlock(&ses->chan_lock);
481+
return 0;
489482
}
490483

484+
ses->chans[chan_index].iface = iface;
485+
spin_unlock(&ses->chan_lock);
486+
491487
return rc;
492488
}
493489

0 commit comments

Comments
 (0)