NFS: Fix bool initialization/comparison
authorThomas Meyer <thomas@m3y3r.de>
Sat, 7 Oct 2017 14:02:21 +0000 (16:02 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Feb 2020 21:31:07 +0000 (16:31 -0500)
[ Upstream commit 6089dd0d731028531fb1148be9fd33274ff90da4 ]

Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/callback_proc.c
fs/nfs/dir.c
fs/nfs/nfs4client.c
fs/nfs/pnfs.c

index 9d7537446260b58aebfca9368c026b42eefa1082..0d4a56c77a1a98b82b0801959b12128b59c30a47 100644 (file)
@@ -419,7 +419,7 @@ static bool referring_call_exists(struct nfs_client *clp,
                                  uint32_t nrclists,
                                  struct referring_call_list *rclists)
 {
-       bool status = 0;
+       bool status = false;
        int i, j;
        struct nfs4_session *session;
        struct nfs4_slot_table *tbl;
index 5936c54ac5fdb6475b7b4e7942482375fe6917aa..2c6e64dce2bdbeabb2204721fa0e45383ec68225 100644 (file)
@@ -289,7 +289,7 @@ int nfs_readdir_search_for_pos(struct nfs_cache_array *array, nfs_readdir_descri
        desc->cache_entry_index = index;
        return 0;
 out_eof:
-       desc->eof = 1;
+       desc->eof = true;
        return -EBADCOOKIE;
 }
 
@@ -343,7 +343,7 @@ int nfs_readdir_search_for_cookie(struct nfs_cache_array *array, nfs_readdir_des
        if (array->eof_index >= 0) {
                status = -EBADCOOKIE;
                if (*desc->dir_cookie == array->last_cookie)
-                       desc->eof = 1;
+                       desc->eof = true;
        }
 out:
        return status;
@@ -812,7 +812,7 @@ int nfs_do_filldir(nfs_readdir_descriptor_t *desc)
                ent = &array->array[i];
                if (!dir_emit(desc->ctx, ent->string.name, ent->string.len,
                    nfs_compat_user_ino64(ent->ino), ent->d_type)) {
-                       desc->eof = 1;
+                       desc->eof = true;
                        break;
                }
                desc->ctx->pos++;
@@ -824,7 +824,7 @@ int nfs_do_filldir(nfs_readdir_descriptor_t *desc)
                        ctx->duped = 1;
        }
        if (array->eof_index >= 0)
-               desc->eof = 1;
+               desc->eof = true;
 
        nfs_readdir_release_array(desc->page);
 out:
@@ -925,7 +925,7 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx)
                if (res == -EBADCOOKIE) {
                        res = 0;
                        /* This means either end of directory */
-                       if (*desc->dir_cookie && desc->eof == 0) {
+                       if (*desc->dir_cookie && !desc->eof) {
                                /* Or that the server has 'lost' a cookie */
                                res = uncached_readdir(desc);
                                if (res == 0)
index 1ec6dd4f3e2e4c034c4888c9417c1aa453f0ca51..3ee60c5332179b38c7b0b5f284f2c5293a98267c 100644 (file)
@@ -847,7 +847,7 @@ nfs4_find_client_sessionid(struct net *net, const struct sockaddr *addr,
 
        spin_lock(&nn->nfs_client_lock);
        list_for_each_entry(clp, &nn->nfs_client_list, cl_share_link) {
-               if (nfs4_cb_match_client(addr, clp, minorversion) == false)
+               if (!nfs4_cb_match_client(addr, clp, minorversion))
                        continue;
 
                if (!nfs4_has_session(clp))
index 0e008db16b169c998875cdbebc08385cdb0ff4d3..c3abf92adfb7d05fbaa23d9f4c3bce89cb36b8ad 100644 (file)
@@ -1436,7 +1436,7 @@ pnfs_lseg_range_match(const struct pnfs_layout_range *ls_range,
        if ((range->iomode == IOMODE_RW &&
             ls_range->iomode != IOMODE_RW) ||
            (range->iomode != ls_range->iomode &&
-            strict_iomode == true) ||
+            strict_iomode) ||
            !pnfs_lseg_range_intersecting(ls_range, range))
                return 0;