All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/core: remove useless type conversion to bool
@ 2021-11-19  1:54 Bernard Zhao
  2021-11-19  7:08 ` Ilias Apalodimas
  2021-11-19  9:59 ` Joe Perches
  0 siblings, 2 replies; 3+ messages in thread
From: Bernard Zhao @ 2021-11-19  1:54 UTC (permalink / raw)
  To: Jesper Dangaard Brouer, Ilias Apalodimas, David S. Miller,
	Jakub Kicinski, netdev, linux-kernel
  Cc: Bernard Zhao

(ret == 0) is bool value, the type conversion to true/false value
is not needed.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
---
 net/core/page_pool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 9b60e4301a44..d660d46f6ad6 100644
--- 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);
 }
 
 /* Only allow direct recycling in special circumstances, into the
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net/core: remove useless type conversion to bool
  2021-11-19  1:54 [PATCH] net/core: remove useless type conversion to bool Bernard Zhao
@ 2021-11-19  7:08 ` Ilias Apalodimas
  2021-11-19  9:59 ` Joe Perches
  1 sibling, 0 replies; 3+ messages in thread
From: Ilias Apalodimas @ 2021-11-19  7:08 UTC (permalink / raw)
  To: Bernard Zhao
  Cc: Jesper Dangaard Brouer, David S. Miller, Jakub Kicinski, netdev,
	linux-kernel

On Thu, Nov 18, 2021 at 05:54:21PM -0800, Bernard Zhao wrote:
> (ret == 0) is bool value, the type conversion to true/false value
> is not needed.
> 
> Signed-off-by: Bernard Zhao <bernard@vivo.com>
> ---
>  net/core/page_pool.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> index 9b60e4301a44..d660d46f6ad6 100644
> --- 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);
>  }
>  
>  /* Only allow direct recycling in special circumstances, into the
> -- 
> 2.33.1
> 
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net/core: remove useless type conversion to bool
  2021-11-19  1:54 [PATCH] net/core: remove useless type conversion to bool Bernard Zhao
  2021-11-19  7:08 ` Ilias Apalodimas
@ 2021-11-19  9:59 ` Joe Perches
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2021-11-19  9:59 UTC (permalink / raw)
  To: Bernard Zhao, Jesper Dangaard Brouer, Ilias Apalodimas,
	David S. Miller, Jakub Kicinski, netdev, linux-kernel

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;
?



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-19  9:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19  1:54 [PATCH] net/core: remove useless type conversion to bool Bernard Zhao
2021-11-19  7:08 ` Ilias Apalodimas
2021-11-19  9:59 ` Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.