[PATCH 3/3] cifs: simplify a check in cifs_chan_update_iface()

From: Dan Carpenter
Date: Mon Jan 08 2024 - 04:10:14 EST


The loop iterator in a list_for_each() loop is never NULL at the end.
This condition uses a two step process of setting the iterator, "iface",
from non-NULL to NULL and then checking if it's NULL. It's easier to do
in one step.

Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
fs/smb/client/sess.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c
index f7b216dd06b2..987188e1929e 100644
--- a/fs/smb/client/sess.c
+++ b/fs/smb/client/sess.c
@@ -363,7 +363,7 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
{
unsigned int chan_index;
size_t iface_weight = 0, iface_min_speed = 0;
- struct cifs_server_iface *iface = NULL;
+ struct cifs_server_iface *iface;
struct cifs_server_iface *old_iface = NULL;
struct cifs_server_iface *last_iface = NULL;
struct sockaddr_storage ss;
@@ -432,11 +432,6 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
}

if (list_entry_is_head(iface, &ses->iface_list, iface_head)) {
- iface = NULL;
- cifs_dbg(FYI, "unable to find a suitable iface\n");
- }
-
- if (!iface) {
if (!chan_index)
cifs_dbg(FYI, "unable to get the interface matching: %pIS\n",
&ss);
--
2.42.0