[PATCH 4/8] radix_tree: Convert some variables to unsigned types

From: Matthew Wilcox
Date: Tue Jan 19 2016 - 09:25:56 EST


From: Matthew Wilcox <willy@xxxxxxxxxxxxxxx>

None of these can ever be negative, and it removes a few -Wsign-compare
warnings.

Signed-off-by: Matthew Wilcox <willy@xxxxxxxxxxxxxxx>
---
lib/radix-tree.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 357b556..7a984ad 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -64,7 +64,7 @@ static struct kmem_cache *radix_tree_node_cachep;
* Per-cpu pool of preloaded nodes
*/
struct radix_tree_preload {
- int nr;
+ unsigned nr;
/* nodes->private_data points to next preallocated node */
struct radix_tree_node *nodes;
};
@@ -130,7 +130,7 @@ static inline int root_tag_get(struct radix_tree_root *root, unsigned int tag)
*/
static inline int any_tag_set(struct radix_tree_node *node, unsigned int tag)
{
- int idx;
+ unsigned idx;
for (idx = 0; idx < RADIX_TREE_TAG_LONGS; idx++) {
if (node->tags[tag][idx])
return 1;
@@ -1453,7 +1453,7 @@ static __init unsigned long __maxindex(unsigned int height)

if (shift < 0)
return ~0UL;
- if (shift >= BITS_PER_LONG)
+ if ((unsigned)shift >= BITS_PER_LONG)
return 0UL;
return ~0UL >> shift;
}
--
2.7.0.rc3