From: Dan Carpenter <dan.carpenter@linaro.org>
To: Steve French <sfrench@samba.org>
Cc: Paulo Alcantara <pc@manguebit.com>,
Ronnie Sahlberg <lsahlber@redhat.com>,
Shyam Prasad N <sprasad@microsoft.com>,
Tom Talpey <tom@talpey.com>,
linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH 3/3] cifs: simplify a check in cifs_chan_update_iface()
Date: Mon, 8 Jan 2024 12:09:27 +0300 [thread overview]
Message-ID: <eef8b278-97b5-4858-b05f-5cfc454cc614@moroto.mountain> (raw)
In-Reply-To: <b628a706-d356-4629-a433-59dfda24bb94@moroto.mountain>
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 --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
next prev parent reply other threads:[~2024-01-08 9:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-08 9:07 [PATCH 1/3] cifs: delete unnecessary NULL checks " Dan Carpenter
2024-01-08 9:08 ` [PATCH 2/3] cifs: make cifs_chan_update_iface() a void function Dan Carpenter
2024-01-08 19:09 ` Christophe JAILLET
2024-01-09 4:41 ` Steve French
2024-01-09 7:44 ` Dan Carpenter
2024-01-09 7:39 ` Dan Carpenter
2024-01-09 4:42 ` Steve French
2024-01-08 9:09 ` Dan Carpenter [this message]
2024-01-09 0:52 ` [PATCH 1/3] cifs: delete unnecessary NULL checks in cifs_chan_update_iface() Steve French
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eef8b278-97b5-4858-b05f-5cfc454cc614@moroto.mountain \
--to=dan.carpenter@linaro.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lsahlber@redhat.com \
--cc=pc@manguebit.com \
--cc=samba-technical@lists.samba.org \
--cc=sfrench@samba.org \
--cc=sprasad@microsoft.com \
--cc=tom@talpey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®