diff mbox series

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

Message ID eef8b278-97b5-4858-b05f-5cfc454cc614@moroto.mountain
State New
Headers show
Series [1/3] cifs: delete unnecessary NULL checks in cifs_chan_update_iface() | expand

Commit Message

Dan Carpenter Jan. 8, 2024, 9:09 a.m. UTC
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@linaro.org>
---
 fs/smb/client/sess.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
diff mbox series

Patch

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);