diff mbox

ceph: return proper bool type to caller instead of pointer

Message ID 1520909025-70638-1-git-send-email-cgxu519@gmx.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chengguang Xu March 13, 2018, 2:43 a.m. UTC
Change to return true/false only for bool type return code.

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
---
 fs/ceph/mds_client.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Yan, Zheng March 14, 2018, 8:12 a.m. UTC | #1
On Tue, Mar 13, 2018 at 10:43 AM, Chengguang Xu <cgxu519@gmx.com> wrote:
> Change to return true/false only for bool type return code.
>
> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
> ---
>  fs/ceph/mds_client.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index e932c06..70d696b 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -439,9 +439,10 @@ struct ceph_mds_session *__ceph_lookup_mds_session(struct ceph_mds_client *mdsc,
>
>  static bool __have_session(struct ceph_mds_client *mdsc, int mds)
>  {
> -       if (mds >= mdsc->max_sessions)
> +       if (mds >= mdsc->max_sessions || !mdsc->sessions[mds])
>                 return false;
> -       return mdsc->sessions[mds];
> +       else
> +               return true;
>  }
>
>  static int __verify_registered_session(struct ceph_mds_client *mdsc,
> --
> 1.8.3.1
>

Applied, thanks
Yan, Zheng

> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index e932c06..70d696b 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -439,9 +439,10 @@  struct ceph_mds_session *__ceph_lookup_mds_session(struct ceph_mds_client *mdsc,
 
 static bool __have_session(struct ceph_mds_client *mdsc, int mds)
 {
-	if (mds >= mdsc->max_sessions)
+	if (mds >= mdsc->max_sessions || !mdsc->sessions[mds])
 		return false;
-	return mdsc->sessions[mds];
+	else
+		return true;
 }
 
 static int __verify_registered_session(struct ceph_mds_client *mdsc,