diff mbox series

net/core: remove useless type conversion to bool

Message ID 20211119015421.108124-1-bernard@vivo.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net/core: remove useless type conversion to bool | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 2 this patch: 2
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang success Errors and warnings before: 22 this patch: 22
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 6 this patch: 6
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Bernard Zhao Nov. 19, 2021, 1:54 a.m. UTC
(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(-)

Comments

Ilias Apalodimas Nov. 19, 2021, 7:08 a.m. UTC | #1
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>
Joe Perches Nov. 19, 2021, 9:59 a.m. UTC | #2
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;
?
diff mbox series

Patch

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