Re: [PATCH] net/core: remove useless type conversion to bool

From: Joe Perches
Date: Fri Nov 19 2021 - 04:59:32 EST


On Thu, 2021-11-18 at 17:54 -0800, Bernard Zhao wrote:
> (ret == 0) is bool value, the type conversion to true/false value
> is not needed.
[]
> diff --git a/net/core/page_pool.c b/net/core/page_pool.c
[]
> @@ -398,7 +398,7 @@ static bool page_pool_recycle_in_ring(struct page_pool *pool, struct page *page)
> else
> ret = ptr_ring_produce_bh(&pool->ring, page);
>
> - return (ret == 0) ? true : false;
> + return (ret == 0);

This doesn't need the parentheses either.

Maybe:
return !ret;
or
return ret == 0;
?