Skip to content

Commit

Permalink
cifs: delete unnecessary NULL checks in cifs_chan_update_iface()
Browse files Browse the repository at this point in the history
We return early if "iface" is NULL so there is no need to check here.
Delete those checks.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
  • Loading branch information
Dan Carpenter authored and Steve French committed Jan 9, 2024
1 parent 8a3c4e4 commit c3a11c0
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions fs/smb/client/sess.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,27 +467,23 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
kref_put(&old_iface->refcount, release_iface);
} else if (!chan_index) {
/* special case: update interface for primary channel */
if (iface) {
cifs_dbg(FYI, "referencing primary channel iface: %pIS\n",
&iface->sockaddr);
iface->num_channels++;
iface->weight_fulfilled++;
}
cifs_dbg(FYI, "referencing primary channel iface: %pIS\n",
&iface->sockaddr);
iface->num_channels++;
iface->weight_fulfilled++;
}
spin_unlock(&ses->iface_lock);

if (iface) {
spin_lock(&ses->chan_lock);
chan_index = cifs_ses_get_chan_index(ses, server);
if (chan_index == CIFS_INVAL_CHAN_INDEX) {
spin_unlock(&ses->chan_lock);
return 0;
}

ses->chans[chan_index].iface = iface;
spin_lock(&ses->chan_lock);
chan_index = cifs_ses_get_chan_index(ses, server);
if (chan_index == CIFS_INVAL_CHAN_INDEX) {
spin_unlock(&ses->chan_lock);
return 0;
}

ses->chans[chan_index].iface = iface;
spin_unlock(&ses->chan_lock);

return rc;
}

Expand Down

0 comments on commit c3a11c0

Please sign in to comment.