Re: [PATCH -next 2/2] bcache: Use max_t() when comparing different types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2014-01-15 at 10:06 +0100, Geert Uytterhoeven wrote:
> drivers/md/bcache/btree.c: In function ‘insert_u64s_remaining’:
> drivers/md/bcache/btree.c:1816: warning: comparison of distinct pointer types lacks a cast
[]
> diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
[]
> @@ -1813,7 +1813,7 @@ static size_t insert_u64s_remaining(struct btree *b)
>  	if (b->keys.ops->is_extents)
>  		ret -= KEY_MAX_U64S;
>  
> -	return max(ret, 0L);
> +	return max_t(ssize_t, ret, 0L);

why not
	return max(ret, 0);

I think it odd that:

drivers/md/bcache/bset.h:static inline size_t bch_btree_keys_u64s_remaining(struct btree_keys *b)

and:

static size_t insert_u64s_remaining(struct btree *b)
{
	ssize_t ret = bch_btree_keys_u64s_remaining(&b->keys);

	/*
	 * Might land in the middle of an existing extent and have to split it
	 */
	if (b->keys.ops->is_extents)
		ret -= KEY_MAX_U64S;

	return max(ret, 0L);
}

so the only use of that size_t inline is cast to ssize_t


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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux