[PATCH v2 5/7] staging: lustre: handle NULL comparisons correctly for libcfs_hash.h

From: James Simmons
Date: Mon Nov 02 2015 - 12:23:34 EST


Remove all direct NULL comparisons in libcfs_hash.h.

Signed-off-by: James Simmons <jsimmons@xxxxxxxxxxxxx>
---
.../lustre/include/linux/libcfs/libcfs_hash.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h
index 87dee16..6bd2012 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h
@@ -827,7 +827,7 @@ cfs_hash_djb2_hash(const void *key, size_t size, unsigned mask)
{
unsigned i, hash = 5381;

- LASSERT(key != NULL);
+ LASSERT(key);

for (i = 0; i < size; i++)
hash = hash * 33 + ((char *)key)[i];
@@ -855,7 +855,7 @@ cfs_hash_u64_hash(const __u64 key, unsigned mask)

/** iterate over all buckets in @bds (array of struct cfs_hash_bd) */
#define cfs_hash_for_each_bd(bds, n, i) \
- for (i = 0; i < n && (bds)[i].bd_bucket != NULL; i++)
+ for (i = 0; i < n && (bds)[i].bd_bucket; i++)

/** iterate over all buckets of @hs */
#define cfs_hash_for_each_bucket(hs, bd, pos) \
--
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/