Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1609268

Re: [PATCH 1/2] rcu: use bool value directly

From "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] rcu: use bool value directly
Date 2017-03-26 03:30 +0200
Message-ID <tp5ah-PA-1@gated-at.bofh.it> (permalink)
References <toZRf-5s0-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sat, Mar 25, 2017 at 08:46:01PM +0100, Nicholas Mc Guire wrote:
> beenonline is declared bool so no need for an explicit comparison
> 
> Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>

Queued both for review and testing, thank you!

						Thanx, Paul

> ---
> 
> Found by coccinelle: boolinit.cocci complained about
> ./kernel/rcu/tree.c:2986:14-29: WARNING: Comparison of bool to 0/1
> 
> If the comparison was intended for readability I guess it should be
> against "false" not 0 - but it seems common to just use bool values
> directly.
> 
> Patch was compile-tested with: x86_64_defconfig (implies CONFIG_TREE_RCU=y)
> (with some sparse warnings)
> 
> Patch is against 4.11-rc3 (localversion-next is next-20170324)
> 
>  kernel/rcu/tree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 712ddce..ab9fbec 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -2983,7 +2983,7 @@ __rcu_process_callbacks(struct rcu_state *rsp)
>  	bool needwake;
>  	struct rcu_data *rdp = raw_cpu_ptr(rsp->rda);
> 
> -	WARN_ON_ONCE(rdp->beenonline == 0);
> +	WARN_ON_ONCE(!rdp->beenonline);
> 
>  	/* Update RCU state based on any recent quiescent states. */
>  	rcu_check_quiescent_state(rsp, rdp);
> -- 
> 2.1.4
> 

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] rcu: use bool value directly Nicholas Mc Guire <der.herr@hofr.at> - 2017-03-25 20:50 +0100
  [PATCH 2/2] rcu: tree_plugin.h: use true/false in assignment to bool Nicholas Mc Guire <der.herr@hofr.at> - 2017-03-25 20:50 +0100
  Re: [PATCH 1/2] rcu: use bool value directly "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-03-26 03:30 +0200

csiph-web