From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Dan Carpenter <dan.carpenter@linaro.org>,
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: Re: [PATCH 2/3] cifs: make cifs_chan_update_iface() a void function
Date: Mon, 8 Jan 2024 20:09:17 +0100 [thread overview]
Message-ID: <4c6b12c9-0502-400a-b2ba-dad89ef4f652@wanadoo.fr> (raw)
In-Reply-To: <eac139a7-76d4-4067-8c25-15e30692aaf9@moroto.mountain>
Le 08/01/2024 à 10:08, Dan Carpenter a écrit :
> The return values for cifs_chan_update_iface() didn't match what the
> documentation said and nothing was checking them anyway. Just make it
> a void function.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> fs/smb/client/cifsproto.h | 2 +-
> fs/smb/client/sess.c | 17 +++++++----------
> 2 files changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/fs/smb/client/cifsproto.h b/fs/smb/client/cifsproto.h
> index afbab86331a1..a841bf4967fa 100644
> --- a/fs/smb/client/cifsproto.h
> +++ b/fs/smb/client/cifsproto.h
> @@ -656,7 +656,7 @@ cifs_chan_is_iface_active(struct cifs_ses *ses,
> struct TCP_Server_Info *server);
> void
> cifs_disable_secondary_channels(struct cifs_ses *ses);
> -int
> +void
> cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server);
> int
> SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon, bool in_mount);
> diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c
> index 775c6a4a2f4b..f7b216dd06b2 100644
> --- a/fs/smb/client/sess.c
> +++ b/fs/smb/client/sess.c
> @@ -356,10 +356,9 @@ cifs_disable_secondary_channels(struct cifs_ses *ses)
>
> /*
> * update the iface for the channel if necessary.
> - * will return 0 when iface is updated, 1 if removed, 2 otherwise
> * Must be called with chan_lock held.
> */
> -int
> +void
> cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
> {
> unsigned int chan_index;
> @@ -368,20 +367,19 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
> struct cifs_server_iface *old_iface = NULL;
> struct cifs_server_iface *last_iface = NULL;
> struct sockaddr_storage ss;
> - int rc = 0;
>
> 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;
> + return;
> }
>
> if (ses->chans[chan_index].iface) {
> old_iface = ses->chans[chan_index].iface;
> if (old_iface->is_active) {
> spin_unlock(&ses->chan_lock);
> - return 1;
> + return;
> }
> }
> spin_unlock(&ses->chan_lock);
> @@ -394,7 +392,7 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
> if (!ses->iface_count) {
> spin_unlock(&ses->iface_lock);
> cifs_dbg(VFS, "server %s does not advertise interfaces\n", ses->server->hostname);
> - return 0;
> + return;
> }
>
> last_iface = list_last_entry(&ses->iface_list, struct cifs_server_iface,
> @@ -434,7 +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)) {
> - rc = 1;
> iface = NULL;
> cifs_dbg(FYI, "unable to find a suitable iface\n");
> }
> @@ -449,7 +446,7 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
> }
>
> spin_unlock(&ses->iface_lock);
> - return 0;
> + return;
> }
>
> /* now drop the ref to the current iface */
> @@ -478,13 +475,13 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
> chan_index = cifs_ses_get_chan_index(ses, server);
> if (chan_index == CIFS_INVAL_CHAN_INDEX) {
> spin_unlock(&ses->chan_lock);
> - return 0;
> + return;
> }
>
> ses->chans[chan_index].iface = iface;
> spin_unlock(&ses->chan_lock);
>
> - return rc;
> + return;
just remove this one?
CJ
> }
>
> /*
next prev parent reply other threads:[~2024-01-08 19: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 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 [this message]
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
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=4c6b12c9-0502-400a-b2ba-dad89ef4f652@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=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®