mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] cifs: delete unnecessary NULL checks in cifs_chan_update_iface()
@ 2024-01-08  9:07 Dan Carpenter
  2024-01-08  9:08 ` [PATCH 2/3] cifs: make cifs_chan_update_iface() a void function Dan Carpenter
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Dan Carpenter @ 2024-01-08  9:07 UTC (permalink / raw)
  To: Steve French
  Cc: Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
	linux-cifs, samba-technical, linux-kernel, kernel-janitors

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>
---
 fs/smb/client/sess.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c
index a16e175731eb..775c6a4a2f4b 100644
--- a/fs/smb/client/sess.c
+++ b/fs/smb/client/sess.c
@@ -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;
 }
 
-- 
2.42.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-01-09  7:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-08  9:07 [PATCH 1/3] cifs: delete unnecessary NULL checks in cifs_chan_update_iface() 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 ` [PATCH 3/3] cifs: simplify a check in cifs_chan_update_iface() Dan Carpenter
2024-01-09  0:52 ` [PATCH 1/3] cifs: delete unnecessary NULL checks " Steve French

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®